User Tools

Site Tools


git_revert

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_revert [2019/03/13 10:00]
rpjday [Reverting a single commit]
git_revert [2019/03/13 12:49] (current)
rpjday [Reverting a range of commits]
Line 10: Line 10:
 git revert --quit git revert --quit
 git revert --abort git revert --abort
 +</​code>​
 +
 +===== DESCRIPTION =====
 +
 +Note carefully //lack of traversal//:​
 +
 +<​code>​
 +<​commit>​...
 +    Commits to revert. For a more complete list of ways to
 +    spell commit names, see gitrevisions(7). Sets of commits
 +    can also be given but no traversal is done by default, see
 +    git-rev-list(1) and its --no-walk option.
 </​code>​ </​code>​
  
Line 22: Line 34:
 </​code>​ </​code>​
  
-which throws you into a commit edit session:+which throws you into a commit edit session ​based on the earlier commit message:
  
 <​code>​ <​code>​
Line 35: Line 47:
 ==== Reverting a range of commits ==== ==== Reverting a range of commits ====
  
-Revert commits individually:​+Revert commits individually ​(revert ''​v1.0''​ (not included) up to and //​including//​ ''​v1.1''​):
  
 <​code>​ <​code>​
-$ git revert v1.0 v1.1+$ git revert v1.0..v1.1
 </​code>​ </​code>​
  
Line 44: Line 56:
  
 <​code>​ <​code>​
-$ git revert -n v1.0 v1.1+$ git revert -n v1.0..v1.1 
 +</​code>​ 
 + 
 +==== Reverting one file ==== 
 + 
 +<​code>​ 
 +$ git diff HEAD HEAD^ -- <​filename>​ | git apply -
 </​code>​ </​code>​
git_revert.1552471242.txt.gz · Last modified: 2019/03/13 10:00 by rpjday