git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* modifying the commits before push
@ 2012-01-18 17:49 Sam Steingold
  2012-01-18 20:18 ` Dirk Süsserott
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2012-01-18 17:49 UTC (permalink / raw)
  To: git

Hi,
I am trying to push:
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#
nothing to commit (working directory clean)
$
but `git push` fails with this:

remote: ERROR: Rejecting update because this commit email is not from ZZZ

What I need to do is
- modify the 4 commits with a different e-mail and do `git push` again
- make sure that all my commits in this repo are done with the correct e-mail

how do I do this?

thanks!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://pmw.org.il http://jihadwatch.org http://thereligionofpeace.com
http://openvotingconsortium.org http://ffii.org http://camera.org
Let us remember that ours is a nation of lawyers and order.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: modifying the commits before push
  2012-01-18 17:49 modifying the commits before push Sam Steingold
@ 2012-01-18 20:18 ` Dirk Süsserott
  2012-01-18 21:47   ` Sam Steingold
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Süsserott @ 2012-01-18 20:18 UTC (permalink / raw)
  To: git, sds

Am 18.01.2012 18:49 schrieb Sam Steingold:
> Hi,
> I am trying to push:
> $ git status
> # On branch master
> # Your branch is ahead of 'origin/master' by 4 commits.
> #
> nothing to commit (working directory clean)
> $
> but `git push` fails with this:
> 
> remote: ERROR: Rejecting update because this commit email is not from ZZZ
> 
> What I need to do is
> - modify the 4 commits with a different e-mail and do `git push` again
> - make sure that all my commits in this repo are done with the correct e-mail
> 
> how do I do this?
> 
> thanks!
> 


Hi Sam,

to modify the last 4 commits you can use git filter-branch (see the
manpage):

$ git checkout master
$ git filter-branch --env-filter \
   'GIT_COMMITTER_EMAIL="sds@gnu.org" \
    GIT_COMMITTER_NAME="Sam Steingold"' \
   HEAD~4..HEAD

It should tell you that it rewrites 4 commits. The original tree is
saved under original/refs/heads/master. If sth. went wrong, reset your
master to that point (easiest with gitk, it's steel blue). If it worked,
you can delete the original/refs/heads/master like so:

$ git for-each-ref --format="%(refname)" \
    refs/original/ | xargs -n 1 git update-ref -d

Note: Whether it worked or not, remove the original refs afterwards,
because a second run of git filter-branch will fail if there's already
an "original" tree.

To change your address for future commits configure it in .gitconfig in
your $HOME (--global) or on a per repo basis in .git/config (--local):

$ git config --global user.email "sds@gnu.org"
$ git config --global user.name "Sam Steingold"

Or use git gui for this step (Edit -> Options).

HTH
    Dirk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: modifying the commits before push
  2012-01-18 20:18 ` Dirk Süsserott
@ 2012-01-18 21:47   ` Sam Steingold
  2012-01-18 22:01     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2012-01-18 21:47 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: git

Hi Dirk,

> * Dirk Süsserott <arjfyrggre@qvex.zl1.pp> [2012-01-18 21:18:34 +0100]:
> Am 18.01.2012 18:49 schrieb Sam Steingold:
>
> to modify the last 4 commits you can use git filter-branch (see the
> manpage):
>
> $ git checkout master
> $ git filter-branch --env-filter \
>    'GIT_COMMITTER_EMAIL="sds@gnu.org" \
>     GIT_COMMITTER_NAME="Sam Steingold"' \
>    HEAD~4..HEAD
>
> It should tell you that it rewrites 4 commits.

I did this; I got a few messages which scrolled very quickly.
status code was 0, apparently, I was successful.

> The original tree is saved under original/refs/heads/master.

where is that?

> If sth. went wrong, reset your master to that point (easiest with
> gitk, it's steel blue). If it worked, you can delete the
> original/refs/heads/master like so:
>
> $ git for-each-ref --format="%(refname)" \
>     refs/original/ | xargs -n 1 git update-ref -d
>
> Note: Whether it worked or not, remove the original refs afterwards,
> because a second run of git filter-branch will fail if there's already
> an "original" tree.

alas, I could not push because the remote tree was modified in the
meantime, I pulled and now:

# On branch master
# Your branch is ahead of 'origin/master' by 23 commits.
#
nothing to commit (working directory clean)


so, what do I do now?

is there a way for me to get back my original 4 patches, reset my tree
(maybe by rm-rf+clone) and then re-apply them?

thanks!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://jihadwatch.org http://memri.org http://thereligionofpeace.com
http://www.PetitionOnline.com/tap12009/ http://palestinefacts.org
I don't have an attitude problem. You have a perception problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: modifying the commits before push
  2012-01-18 21:47   ` Sam Steingold
@ 2012-01-18 22:01     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2012-01-18 22:01 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: git

Sam Steingold <sds@gnu.org> writes:

> alas, I could not push because the remote tree was modified in the
> meantime, I pulled and now:
>
> # On branch master
> # Your branch is ahead of 'origin/master' by 23 commits.

What exactly did you do to get the additional 19 commits?

> is there a way for me to get back my original 4 patches, reset my tree
> (maybe by rm-rf+clone) and then re-apply them?

You can find them in the reflog (git log -g).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-18 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 17:49 modifying the commits before push Sam Steingold
2012-01-18 20:18 ` Dirk Süsserott
2012-01-18 21:47   ` Sam Steingold
2012-01-18 22:01     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).