[git-users] Re: How to revert --amend

2012-11-11 Thread zzz


On Thursday, November 8, 2012 9:42:56 PM UTC, Daniel Dotsenko wrote:
>
> Re "reverting -ammend'ed commit"
>
> "git -ammend" unpacks previous commit, adds more changes to it and creates 
> a new commit. The old commit can potentially still be around as blob until 
> you "git gc" but is definitely not visible to you anymore. ...
>

Until the old commit has been garbage-collected, "git reflog" will provide 
its SHA1; you are then able to do all the usual git things with it.

-- 




[git-users] Re: How to revert --amend

2012-11-08 Thread Daniel Dotsenko
Re "reverting -ammend'ed commit"

"git -ammend" unpacks previous commit, adds more changes to it and creates 
a new commit. The old commit can potentially still be around as blob until 
you "git gc" but is definitely not visible to you anymore. So, "reverting" 
an "-ammend" action to get "same" commit point but in pre-ammend stage is 
practically very hard or near-impossible with git's standard machinery.

If you want to get pre-ammend stage commit you:
1. Could look at places where you might have pushed the original commit and 
merge it back into your tree, or
2. If there is no longer a copy of pre-ammend'ed commit anywhere on other 
servers, you could fake its contents by ammending ammended commit to bring 
it to content stage where it needs to be, but the time-stamp and hash will 
be different.

Effectively, unless you "find" the pre-ammended commit elsewhere, 
recovering it exactly (same hash)  is no-go.

Now, none of this may be answering your question, but then you would need 
to blame your phrasing of the question :)

Daniel


On Thursday, November 8, 2012 12:29:16 PM UTC-8, kramer.newsreader wrote:
>
> Hi, I made a commit and pushed it to a remote repo (gerrit).
>
> It turns out that my commit needs to be reverted and different changes 
> need to be commited.  According to our process, all changes for a given 
> ticket should be pushed as an amended commit.  That way gerrit can combine 
> them.
>
> Anyway, it turns out that --amend is not an option for revert, so it 
> creates a new commit.
>
> Any help would be appreciated.
>

--