On Wednesday, June 27, 2012 1:52:39 AM UTC+2, Mostafa Alshrief wrote: > > > Git will bring along any uncommitted changes when checking out another >> branch. It doesn't corrupt or change the branches >> > i meant missing the content of the master branch by updating it's content > from the develop branch. >
I'm afraid I don't understand. Could you illustrate this problem by describing the expected and actual results, along with the git commands you are using and their output? > If any of the uncommitted changes collide with files changed between >> branches, it will refuse to switch, and ask you to stash the changes first >> > what do you mean by collide with files..? > If I am in a branch A, and I want to switch to branch B, and I have local changes in a file which was not identical in A and B to begin with: Imagine these two branches both have the same file.txt, and I modify it while on branch A: [A]>echo foo > file.txt I can now freely jump between the branches: [A]✗>git checkout B M file.txt Switched to branch 'B' [B]✗>git checkout A M file.txt Switched to branch 'A' I then decide to commit my changes to file.txt in branch B: [A]✗>git checkout B M file.txt Switched to branch 'B' [B]✗>git add file.txt [B]✗>git commit -m "saving a modification of file in branch B" [B 08fb578] saving a modification of file in branch B 1 file changed, 1 insertion(+), 10 deletions(-) Now, the file is not the same in both branches any more. So if I now make local changes in it again, I will get a conflict when trying to switch back to branch A: [B]>echo foo >> file.txt [B]✗>git checkout A error: Your local changes to the following files would be overwritten by checkout: file.txt Please, commit your changes or stash them before you can switch branches. Aborting -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/u2GGtDn9uJIJ. To post to this group, send email to git-users@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.