忽略了git的承诺一定的变化忽略了、git

2023-09-05 03:59:57 作者:是梦别喊疼,想赢别喊停

我们的团队成员使用不同版本的Visual Studio,并VS似乎自动更新SLN文件code这样的:

Members of our team uses different version of visual studio, and VS seems to automatically update the sln file with code like:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012

每当我们与解决方案合作。我们可以配置混帐忽略这样的变化?我们无意在这条线,但我们感兴趣的.sln文件的其他变化,如的新的csproj加入到该溶液中。

whenever we work with the solution. Can we configure git to ignore such changes? We're not interested in this line, but we are interested in other changes of the .sln file, e.g. adding of new csproj to the solution.

推荐答案

您可以添加涂抹/清洁过滤器混帐它调用的脚本来调整特定的行承诺的时候是一致的。在Can git的空间和标签之间自动切换?,它展示了如何实现一个类似的变化,其中的空格转换为选项卡结账,并返回到空间上提交。

You can add a smudge/clean filter to git which calls a script to tweak the particular line to be consistent when committing. In "Can git automatically switch between spaces and tabs?", it shows how to implement a similar change, where spaces are converted to tabs on checkout, and back to spaces on commit.

您可能会需要编写脚本来识别和修改相关行,而链接的例子使用pre-现有的UNIX的制表符和空格之间交换命令。

You'll probably need to write the script to identify and modify the relevant line, whereas the linked example uses pre-existing unix commands for swapping between tabs and spaces.