> > Remember the three file status's (unstaged, staged, and committed) > that are emphasized so much by the Pro Git book? > > Intellectually I know these distinctions are important, but they still > caught me by suprise today. It turns out that both unstaged and > staged git changes persist between different branch checkouts. So I > wasn't paying enough attention to which branch I was on when I looked > at git status results. My eyes skipped over that extremely important > line in the output about the branch, and I saw there was a subset of > the unstaged changes that I wanted to stage (with git add) and commit. > So I did that. The result (much to my surprise and chagrin) was the > commit was made on the master branch rather than the desired topic > branch. This all happened after I had done a similar add and commit > for a different subset of my changes on the topic branch. The net > result was a merge from topic branch to master could not be a ff-only > merge as demanded by our workflow given in README.developers. I got > out of that mess by rebasing my topic branch with master then ff-only > merging my topic branch onto master to continue to maintain a linear > history for master locally and also for our SF repo when I pushed that > result. > > In conclusion, to reduce such screwups for yourself, pay close > attention to the part of "git status" output that identifies the > branch you have checked out when you are deciding which subset of your > changes indicated by "git status" you want to add (stage) and commit. > If such "wrong branch" commits like above do occur, "git log --oneline > -5" (or whatever number of commits you need to track back to find the > common origin commit of master and topic branches) for your master and > topic branches will help you figure out the mess. In no case should > you ever do anything but a ff-only merge with our adopted git workflow > that is documented in README.developers.
If you have not done this, I would recommend configuring your command prompt so it shows the current git branch when you are in git version controlled directory. Then you will always know what branch you are on: www.developerzen.com/2011/01/10/show-the-current-git-branch-in-your-command-prompt/ -Hazen ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel