[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gits] n00b question about reverting changes



ah thanks. 

my master-branch history looks a little more complicated (and I?m not sure exactly why tbh). Is it possible to say instead 

git revert ?some previous commit?..HEAD ? 

as opposed to a relative marker from HEAD ? 


On Oct 28, 2013, at 10:57 AM, Eric Eide <eeide at cs.utah.edu> wrote:

> 	Suresh> we have a document revision that I?ll call GOOD. Three
> 	Suresh> revisions later, the document got trashed because of someone
> 	Suresh> not fetching before editing or something like that. call the
> 	Suresh> new version BAD. if I want to change the master version back to
> 	Suresh> GOOD, what is the easiest way to do this ? do I have to muck
> 	Suresh> around with rebase ?
> 
> If you are talking about a shared repository, a recommended practice would be
> to add commits that "undo" the last three commits.  This is a job for git
> revert.
> 
> If your master-branch history looks like this:
> 
> 	--> GOOD --> work --> work --> BAD
> 
> Then you can get "undo" the last three commits by doing:
> 
> 	git revert HEAD~2..HEAD
> 
> This creates new commits that undo the the commits since GOOD.  You can then
> push these commits up to the shared repository in the usual way.
> 
> There are ways to remote the bad commits entirely, but this can be confusing if
> you are sharing a repository with other people.  So I don't mention them here!
> 
> Eric.
> 
> -- 
> -------------------------------------------------------------------------------
> Eric Eide <eeide at cs.utah.edu>  .         University of Utah School of Computing
> http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX


--
Suresh Venkatasubramanian 	Web: http://www.cs.utah.edu/~suresh/    
				Blog: http://geomblog.blogspot.com/
Associate Professor, 
School of Computing, University of Utah

Visiting Scientist, 		
Simons Institute for Theoretical Computer Science

The Golden Rule: The one with the gold makes the rules. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.flux.utah.edu/pipermail/gits/attachments/20131028/1e68c784/attachment.html>