Why am I getting "You have more than one commit that you are about to submit" ?

1,252 views
Skip to first unread message

Kevin Wilson

unread,
Nov 7, 2014, 12:17:38 PM11/7/14
to repo-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
After doing "git pull" and getting merge patches, and then trying
to add my changes, prepare a patch, commit it and run "git-review -f
master" (I am working with gerrit), I am getting this message:

git-review --dry-run -f master
You have more than one commit that you are about to submit.
The outstanding commits are:

995f903 (HEAD, remove_my_module_parameter) test
0869068 (master) Merge branch 'master' of ssh://zzz.xxx.com:29418/devbranch
733edbc add remove_my_module_parameter in my module

Is this really what you meant to do?
Type 'yes' to confirm:

Why am I getting "You have more than one commit that you are about to submit." ?
Is there a way to avoid it ?


Regards,
Kevin

Marcin Cieslak

unread,
Nov 7, 2014, 12:54:52 PM11/7/14
to Kevin Wilson, repo-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse


On Fri, 7 Nov 2014, Kevin Wilson wrote:

> After doing "git pull" and getting merge patches, and then trying
> to add my changes, prepare a patch, commit it and run "git-review -f
> master" (I am working with gerrit), I am getting this message:
>
> git-review --dry-run -f master
> You have more than one commit that you are about to submit.
> The outstanding commits are:
>
> 995f903 (HEAD, remove_my_module_parameter) test
> 0869068 (master) Merge branch 'master' of ssh://zzz.xxx.com:29418/devbranch
> 733edbc add remove_my_module_parameter in my module

^ 995f903 and 733edbc seem to be ahead of your upstream master and
gerrit likes to have only one commit per change.

Assuming 733edbc is the change you want to submit and "origin" is
your gerrit remote, I'd fetch a fresh master:

git checkout -B devbranch origin/devbranch

and then put your change on top of that:

git checkout -b remove_par
git cherry-pick -n 733edbc
git commit -c 733edbc


Hope it works for you,

//Marcin

Selberg, Sven

unread,
Nov 10, 2014, 3:28:28 AM11/10/14
to Marcin Cieslak, Kevin Wilson, repo-d...@googlegroups.com
IIUC
It seems to be a workflow problem.
If you are working on master, which tracks origin/master.
When you do $ git pull git will fetch master from origin and try to merge it with your local master, but since your work (y) don’t exist on origin/master you get a merge-commit because the merge is not fast-forward (you have different commit history on master and origin/master.
When you push this merge-commit it will be a separate change so to solve this particular problem cherry-picking your work on top of origin/master and pushing it (as Marcin suggested) is a temporary solution.

What you want to do in the future is work on a local branch
(master) $ git checkout -b my-work
(my-work) $ //do your work and commit
To make sure your my-work branch is up to date with origin/master before you push you do
(my-work) $ git fetch origin //fetch the latest changes from origin to origin/master.
(my-work) $ git rebase origin/master // applies your work on top of the up-to-date origin/master
Now you can push to your Gerrit instance.

I usually delete my local branch after that and if I need to do more work on the change I check-out the change from Gerrit.

/Sven
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Blewitt

unread,
Nov 10, 2014, 4:40:20 AM11/10/14
to Selberg, Sven, Marcin Cieslak, Kevin Wilson, repo-d...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
You can also configure git config —global pull.rebase true, which will ensure that any time you do a pull from a remote repository you will automatically rebase.

Alex
Reply all
Reply to author
Forward
0 new messages