As you have already guessed from the title of this post that I am a beginner in git. So far I was making do with basic pull, diff, add, commit commands in git. But when my mentor reviewed some 10 patches that I sent him and shared his feedback, he suggested me to get familiar with the following three as they were to be my “new best friends” when I incorporate his reviews in my code.
[sourcecode language=”shell” gutter=”false”]
git commit –amend
git add -p
git rebase -i
Barring “git add -p”, the other two will help you to rewrite your commit history. I needed to squash some of the commits, amend nearly all the commit messages and amend some of the commits themselves to make necessary changes in the code based on the feedback from my mentor. Initially, I was very apprehensive about the whole thing. But you can trust Rewriting History chapter of the Pro Git book and get started.