开发者

Git bug or what?

开发者 https://www.devze.com 2023-02-25 07:19 出处:网络
I just got some strange Git behavior. I am working with XCODE4. I have two branches on my repo. one called master and one called VNSLocal. When i checkout VNSLocal branch and make some changes in code

I just got some strange Git behavior. I am working with XCODE4. I have two branches on my repo. one called master and one called VNSLocal. When i checkout VNSLocal branch and make some changes in code there and then switch to master branch, files that has been changes in VNSLocal bransh are shown in master branch as modified too!

Moreover, when i issue git status in Terminal it says that there are modified files on master branch which is totally wrong!

What really bothers me in this situation is that it has been working perfectly for two weeks and out of the blue got broken and i don't understand what happened.

Please, 开发者_StackOverflowhelp me!

Thanks in advance


If you modify a file on one git branch and then change branches before committing, the changes you made will be migrated to the new branch. This is a feature and not a bug.


After experiencing same problem i came across this question.
This is not a feature but a bug.
from master I create a branch
$git checkout -b branch1
... modified file foo
$git checkout master
i saw foo changes in master
$then I go back to branch1 and commit
... modified file foo again
after
$git checkout master
Then finally you get the expected error
"error: Your local changes to the following files would be overwritten by checkou t:"
If sometimes it works and sometimes it does not then it is a bug. (tested with version 1.7.6)

0

精彩评论

暂无评论...
验证码 换一张
取 消