I have two file both are add to repo ignore list. One .vcxprj file and another is .gitignore itself (through add it in file .git/info/exclude). Cause both two files were already tracking, I ran update-index –assume-unchanged <filepah> in the bash. And the “File Status” tab seems OK as Nothing to commit.
and there is output about git status
On branch master
Your branch is behind 'origin/master' by 72 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
But when I tried to checkout a remote branch of this repo. A error comes up,
error: Your local changes to the following files would be overwritten by checkout:
Please commit your changes or stash them before you switch branches.
The Sourcetree version 2.4.8, Git 18.104.22.168, Win7 x64
I don't think you can do what you are trying to do in that way.
I'm assuming you want to effectively have Git forget about the vcxproj file and stop tracking it.
By adding it to the .gitignore you simply telling Git to ignore it from this point on, but other branches etc will still track it, hence the conflict when merging.
See here for some more suggestions:
see also https://www.git-scm.com/docs/git-update-index
Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus, in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event