git更新索引——不假设未更改的索引';行不通
我在几个文件上设置了git更新索引——不假设未更改的索引';行不通,git,Git,我在几个文件上设置了假定未更改位,现在我想取消设置它们,但这不起作用 > git update-index --no-assume-unchanged Gemfile > git ls-files -v | grep Gemfile S Gemfile S Gemfile.lock > git status # On branch foo nothing to commit (working directory clean) > 我的档案当然有变化。有些我不想承诺,有
假定未更改
位,现在我想取消设置它们,但这不起作用
> git update-index --no-assume-unchanged Gemfile
> git ls-files -v | grep Gemfile
S Gemfile
S Gemfile.lock
> git status
# On branch foo
nothing to commit (working directory clean)
>
我的档案当然有变化。有些我不想承诺,有些我愿意。如果其他人更改了这个文件,我就不能合并,因为那个位。看起来真的有点太乱了
所以我有两个问题:
1:我如何取消设置位?
2:有没有更好的方法可以忽略一个特定的本地更改,同时允许对该文件的其他更改正常工作?可能有点晚,但我遇到了与您相同的问题,我使用了
--really refresh
标志解决了这个问题
像这样:
git update-index --really-refresh --no-assume-unchanged Gemfile
希望这对你有用
后期编辑:
如果有多个文件,显然可以分两步完成
git update-index --really-refresh
git update-index --no-assume-unchanged Gemfile