假设git仓库中有文件A B C D,我本地修改了一些,然后使用git status发现A B C都被修改,但A文件其实不能commit(比如去掉了一些LOG,使我调试时能少关注一些东西,但其他人还需要这些LOG)
这样每次git status都会显示出A需要commit(实际有不止一个类似A的文件),然后我需要从这些文件中查找出哪些是确实需要commit的,然后使用git commit B C命令.
我想知道的是:
1.如何不显示A文件的变动,使用git commit -a把其它文件全部commit而不再输入B C的文件名
2.如果A被其他人修改并push,当用我git pull时能取得最新的A
天蓬老师2017-04-24 09:16:04
I just saw this problem some time ago. You can use git update-index --skip-worktree [file] to achieve your needs. There is also a usage of --assume-unchanged. The difference between them can be found in the link.
Related discussion link:
Link 1
Link 2