Git-Review troubleshoot:- Multiple commits error

Playing with code review tools like gerrit and git-review, one of the common error a user can hit with is the Multiple Commits problem.
* You have checked out a new branch, made your edits, added the files and did git commit with necessary commit message.
* You give the command
git review
and git complains that you are going to submit a number of commits.
A sample error screen after giving git review
* You can see your commit on the top of the list with HEAD along with commit id.
* give the following in order
$ git diff HEAD^ This will list down your latest commit. Make sure thats the one you need to commit.
* $ git rebase -i origin/master
This would bring up an interactive git-rebase in your default text editor.
* Delete all the lines, except the line showing your commit message.
* Close the editor. Do $ git review
and it works 🙂 Thanks!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s