Archive for category Git
Sneaky Code (Or When Branches Get Tainted)
We use git at work. Today it turned out that some code that was not meant for the current release sneaked into the branch that got published. This code though was then followed by code that was meant for the current branch. Confusion ensued and I was tasked to fix it. Here’s my solution:
First I took the branch in question and executed a git log. This provided me with a list of commits and their messages. I then branched to a new branch. As part of the branch command I also included the commit I wanted the branch HEAD to be at. This commit was before the shenanigans began. At this point I then began cherry-picking the commits that were supposed to be in the release. It would have been nice to just provide lists of commits, but I couldn’t figure out a way to get this to work with cherry-pick. Once I had all of the commits cherry picked, I pushed this branch to the remote git repo and executed my deploy.
This is the first time I’ve had to do this, and there may be a better way, but all in all I was happy that git provided a means for me to do this at all.

