I am on my local my-feature
branch
git status
reports nothing to commit, working tree clean
I want to switch to develop branch and do git fetch
and git merge
there (I prefer it over git pull
)
However, doing so produces error below
Here I first check status and it shows that all is clean
mymbp:MyProj username$ git status
On branch my-feature
nothing to commit, working tree clean
Next I try to checkout my develop branch which is an existing local branch
On branch my-feature
nothing to commit, working tree clean
mymbp:MyProj username$ git checkout develop
error: Your local changes to the following files would be overwritten by checkout:
MyProj.sln
Please commit your changes or stash them before you switch branches.
Aborting
It complains that myProj.sln
has been changed even though git status
says nothing has changed.
Issuing git status
again, confirms that nothing has changed
mymbp:MyProj username$ git status
On branch my-feature
nothing to commit, working tree clean
UPDATE 1
Doing git ls-files --stage --debug MyProj.sln
shows like below and I dont see any 4000 or 8000 (--skip-worktree
or --assume-unchanged
flags):
mymbp:MyProj username$ git ls-files --stage --debug MyProj.sln
100644 40c3593ed572beb2139c189455274f8900a1340c 0 MyProj.sln
ctime: 1541703970:521058155
mtime: 1541637062:121492660
dev: 16777220 ino: 8470003
uid: 501 gid: 20
size: 55684 flags: 0
mymbp:MyProj username$
Issuing git show develop:MyProj.sln
shows me number of project files and their GUIDs in the solution, Global sections for pre and post solution but the output is very long showing just Release, Debug configurations and some GUIDS. Not sure what to do with that yet.
UPDATE 2
So, it seams as if MyProj.sln file is in work-tree but not in index and commit (HEAD). Based on @torek explanation, issuing git add MyProj.sln should add this file to index but that is not true since nothing is added and git status returns nothing before I did git add and after I did it. Meanwhile git checkout still complains that MyProj.sln has changed. git diff also returns nothing
UPDATE 3
I also found someone suggest issuing these 2 command to get hash of commit HEAD and to then see what changed in it. I see lots of files duplicate, while some do not. Those that do not appear to be files I added in my current feature branch. Those that are duplicate appear to be files from remote
mymbp:MyProj username$ git rev-parse HEAD
1ca8d8a7c5eff0f2a03eb185f1b25aff27c1d2fd
mymbp:MyProj username$ git ls-tree -r 1ca8d8a7c5eff0f2a03eb185f1b25aff27c1d2fd
And here is the output of it
UPDATE 4
My config is:
mymbp:MyProj username$ git config --list
credential.helper=osxkeychain
core.excludesfile=/Users/username/.gitignore_global
core.autocrlf=input
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
user.name=User Name
user.email=username@somesystems.com
color.ui=true
color.status.changed=blue normal
color.status.untracked=red normal
color.status.added=magenta normal
color.status.updated=green normal
color.status.branch=yellow normal bold
color.status.header=white normal bold
commit.template=/Users/username/.stCommitMsg
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/SomeSystems/MyProj.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.develop.remote=origin
branch.develop.merge=refs/heads/develop
branch.feat-1.remote=origin
branch.feat-1.merge=refs/heads/feat/feat-1
branch.1234-refactoring.remote=origin
branch.1234-refactoring.merge=refs/heads/1234-refactoring
mymbp:MyProj username$
See Question&Answers more detail:os