I have quite many files that I set as
git update-index --assume-unchanged <file>
In some cases my branch is messed up and diverged with origin/master. Let's say
and have 4 and 8 different commits each, respectively.
So I want to revert all my commits and keep update to origin/master while keeps my assume-unchanged files not being flushed. How can I do this?
Instead of using --assume-unchanged
, you can try --skip-worktree
with git update-index
.
A file with the flag git update-index --skip-worktree
should resist a git reset
(which would unstage from the index any added changes)
You can see a full analysis of the differences between --assume-unchanged
and --skip-worktree
here.
It looks like
--skip-worktree
is trying very hard to preserve your local data. But it doesn’t prevent you to get upstream changes if it is safe. Plus git doesn’t reset the flag onpull
.
But ignoring the 'reset --hard
' command could become a nasty surprise for a developer.