I have an App.config
file that is modified locally but I do not want to commit the changes:
On branch test
Your branch is up-to-date with 'origin/test'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Test/App.config
no changes added to commit (use "git add" and/or "git commit -a")
So according to another related question I executed the following command:
git update-index --assume-unchanged Test/App.config
So that git status
gives the following output:
On branch test
Your branch is up-to-date with 'origin/test'.
nothing to commit, working directory clean
Everything seems fine, except when I try to switch to another branch. The output when I executed git checkout test2
:
error: Your local changes to the following files would be overwritten by checkout:
Test/App.Config
My question is, is there any way to switch branch while keeping the locally modified file? Or is git stash
the only solution?