1GIT-UNDO(1) Git Extras GIT-UNDO(1)
2
3
4
6 git-undo - Remove latest commits
7
9 git-undo [<commitcount>] [-s, --soft, -h, --hard]
10
12 Removes the latest commits.
13
15 --soft or -s
16
17 Rolls back the commit(s) but leaves the changes in the staging area.
18
19 --hard or -h
20
21 This option wipes your commit(s), so that your changes cannot be recov‐
22 ered. Use with care. To avoid being confused with --help, there will be
23 a confirmation when -h is specified.
24
25 <commitcount>
26
27 Number of commits to remove. Defaults to 1, thus remove the latest com‐
28 mit.
29
31 Removes the latest commit.
32
33
34
35 $ git undo
36
37
38
39 Removes the latest commit, restoring the staging area.
40
41
42
43 $ git undo -s
44
45
46
47 Remove the latest 3 commits:
48
49
50
51 $ git undo 3
52
53
54
56 Written by Kenneth Reitz <me@kennethreitz.com> and Nick Lombard
57 <github@jigsoft.co.za>
58
60 <https://github.com/tj/git-extras/issues>
61
63 <https://github.com/tj/git-extras>
64
65
66
67 June 2018 GIT-UNDO(1)