git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: modifying the commits before push

From
SSSam Steingold <sds@gnu.org>
Date
Jan 18, 2012, 21:47 UTC
Message-ID
<87sjjc3cpj.fsf@gnu.org>
In-Reply-To
<4F17291A.8020600@dirk.my1.cc>
Hi Dirk,
Show 13 quoted lines
> * 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?
Show 10 quoted lines
> 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.
Previous: Dirk SüsserottNext: Andreas Schwab
Message 3 of 4 in “modifying the commits before push”
  1. Sam SteingoldJan 18, 2012
  2. Dirk SüsserottJan 18, 2012
  3. Sam SteingoldJan 18, 2012
  4. Andreas SchwabJan 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.