我有自动python脚本用于git版本控制系统。它适用于Linux,但我在Windows上遇到了一些问题。我将直接讨论问题的核心......
有源代码以LF(不是CRLF)结束,Windows Git Bash可以完美地处理它(结帐为Windows样式并提交为unix样式)。
当我打开Git Bash并输入" git status"我得到了
your branch is up-to-date.....nothing to commit, working directory clean
当我打开cmd.exe并编写" git status"
时....
modified: example.h
modified: example.cpp
....
修改只是因为cmd.exe不处理autocrlf。这个集合只是在行结束。
我尝试了一种解决方法:
c:\myrepo>echo git status|"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
输出:
Welcome to Git (version 1.9.2-preview20140411)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
xxx@yy /c/myrepo (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
xxx@yy /c/myrepo (master)
$
xxx@yy4 /c/myrepo (master)
$ logout
这几乎解决了我的问题,但是有一条恼人的欢迎信息使我的脚本无法正常工作。
另一种解决方法可能是没有--login -i:
c:\myrepo>echo git status|"C:\Program Files (x86)\Git\bin\sh.exe"
输出:
....
modified: example.h
modified: example.cpp
....
没有--login -i的命令解决了欢迎问题,但它没有autoclrf。
我可以delete welcome mesage file,但我希望我的项目在结帐后可用,而不会删除系统中的任何内容。
是否有一些无痛的解决方案?