4

We have two branches in Git, master and develop. master is being updated constantly by a partner group, and I am constantly rebasing our develop branch onto master, something like this:

#(on develop)
$ git pull --rebase origin master #1
$ git rebase origin/develop       #2
$ git push origin develop         #3

…but yesterday someone from the partner group committed onto master without a proper e-mail address, so I encounter a problem by step #2:

git rebase origin/develop
First, rewinding head to replay your work on top of it...
Applying: <...>
<...>
Patch does not have a valid e-mail address.

and git status shows:

$ git status
# Not currently on any branch.
# You are currently rebasing.
#   (all conflicts fixed: run "git rebase --continue")
#
nothing to commit, working directory clean

What I have done is skip the commits without address with git rebase --skip, then cherry-pick these commits back after the rebase. But I wonder is this the proper way to do it? Can I cherry-pick the commit directly in-place, without skipping it? If yes, how do I actually find out this problematic commit (without looking it up in git log), as it is basically the next commit that are to be rebased onto the top of the current commit, so git must somehow knows which one it is…?

Metaphox
  • 2,085
  • 2
  • 21
  • 34
  • You did a rather brutal history rewriting with what you describe, it definitely isn't "the right way". And fixing up that problematic commit locally will also be history rewriting, also bad... as a last resort, OK. But better get the party doing the email-less commiting clean up their act, and have them fix up the mess they created as punishment. – vonbrand Mar 16 '13 at 18:45
  • @vonbrand thanks for the comment, we did give up this rebase-rebase strategy after a while and resorted to simply merging the master branch to develop. And yes, I ended up with asking the remote group to fix the empty email. Still, I was wondering... where does Git know which is the next commit to be rebased? – Metaphox Mar 21 '13 at 08:15

1 Answers1

2

You can try all the suggestions in Change the author and committer name and e-mail of multiple commits in Git

or you can add an -i in there to keep going (useful if you have a persistent auto-tooling commit issue or just want keep going and let someone else to fix their problem eventually)

So, when I get

> git rebase master
First, rewinding head to replay your work on top of it...
Patch does not have a valid e-mail address.

I do git rebase --abort, and then

> git rebase master -i
Successfully rebased and updated refs/heads/mybranch.

This is true for git 2.1.4.

Obviously, it comes up with a rebase list to edit, but you just save unedited that and go on your way.

And yes, it commits it with the "original author <>"

Community
  • 1
  • 1
Stephen
  • 19,488
  • 10
  • 62
  • 83