File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
138
138
* [ Show how many lines does an author contribute] ( #show-how-many-lines-does-an-author-contribute )
139
139
* [ Revert: Reverting an entire merge] ( #revert-reverting-an-entire-merge )
140
140
* [ Number of commits in a branch] ( #number-of-commits-in-a-branch )
141
+ * [ Alias: git undo] ( #alias-git-undo )
141
142
142
143
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
143
144
<!-- @doxie.inject end toc -->
@@ -942,5 +943,10 @@ git revert -m 1 <commit-ish>
942
943
git rev-list --count < branch-name>
943
944
```
944
945
946
+ ## Alias: git undo
947
+ ``` sh
948
+ git config --global alias.undo ' !f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'
949
+ ```
950
+
945
951
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
946
952
<!-- @doxie.inject end -->
Original file line number Diff line number Diff line change 403
403
},{
404
404
"title" : " Number of commits in a branch" ,
405
405
"tip" : " git rev-list --count <branch-name>"
406
+ },{
407
+ "title" : " Alias: git undo" ,
408
+ "tip" : " git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'"
406
409
}]
You can’t perform that action at this time.
0 commit comments