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.
Background:
* 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.
Fix:
* 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!

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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