Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| git_revert [2019/03/12 15:27] – created rpjday | git_revert [2019/03/13 12:49] (current) – [Reverting a range of commits] rpjday | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| git revert --quit | git revert --quit | ||
| git revert --abort | git revert --abort | ||
| + | </ | ||
| + | |||
| + | ===== DESCRIPTION ===== | ||
| + | |||
| + | Note carefully //lack of traversal//: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | 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. | ||
| </ | </ | ||
| ===== The variations ===== | ===== The variations ===== | ||
| - | ==== Reverting | + | ==== Reverting |
| + | |||
| + | How: | ||
| + | |||
| + | < | ||
| + | $ git revert 2965b41 | ||
| + | </ | ||
| + | |||
| + | which throws you into a commit edit session based on the earlier commit message: | ||
| + | |||
| + | < | ||
| + | Revert " | ||
| + | |||
| + | This reverts commit 2965b41fd84a1a76f56984ecdf6c123d1992730f. | ||
| + | ... snip ... | ||
| + | </ | ||
| + | |||
| + | The default is '' | ||
| + | |||
| + | ==== Reverting a range of commits ==== | ||
| + | |||
| + | Revert commits individually (revert '' | ||
| + | |||
| + | < | ||
| + | $ git revert v1.0..v1.1 | ||
| + | </ | ||
| + | |||
| + | Revert commits in one operation but do not commit so you can tweak further: | ||
| + | |||
| + | < | ||
| + | $ git revert -n v1.0..v1.1 | ||
| + | </ | ||
| + | |||
| + | ==== Reverting one file ==== | ||
| + | |||
| + | < | ||
| + | $ git diff HEAD HEAD^ -- < | ||
| + | </ | ||