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 :)


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.


Reply via email to