mirror of
https://github.com/namibia/tips.git
synced 2025-02-02 19:48:24 +00:00
added alias: git undo (#123)
Credits to [Enrico Campidoglio](http://megakemp.com/about/), see [original article](http://megakemp.com/2016/08/25/git-undo/).
This commit is contained in:
parent
08096c7c71
commit
9d7a837add
@ -138,6 +138,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
|
|||||||
* [Show how many lines does an author contribute](#show-how-many-lines-does-an-author-contribute)
|
* [Show how many lines does an author contribute](#show-how-many-lines-does-an-author-contribute)
|
||||||
* [Revert: Reverting an entire merge](#revert-reverting-an-entire-merge)
|
* [Revert: Reverting an entire merge](#revert-reverting-an-entire-merge)
|
||||||
* [Number of commits in a branch](#number-of-commits-in-a-branch)
|
* [Number of commits in a branch](#number-of-commits-in-a-branch)
|
||||||
|
* [Alias: git undo](#alias-git-undo)
|
||||||
|
|
||||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||||
<!-- @doxie.inject end toc -->
|
<!-- @doxie.inject end toc -->
|
||||||
@ -942,5 +943,10 @@ git revert -m 1 <commit-ish>
|
|||||||
git rev-list --count <branch-name>
|
git rev-list --count <branch-name>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Alias: git undo
|
||||||
|
```sh
|
||||||
|
git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'
|
||||||
|
```
|
||||||
|
|
||||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||||
<!-- @doxie.inject end -->
|
<!-- @doxie.inject end -->
|
||||||
|
@ -403,4 +403,7 @@
|
|||||||
},{
|
},{
|
||||||
"title": "Number of commits in a branch",
|
"title": "Number of commits in a branch",
|
||||||
"tip": "git rev-list --count <branch-name>"
|
"tip": "git rev-list --count <branch-name>"
|
||||||
|
},{
|
||||||
|
"title": "Alias: git undo",
|
||||||
|
"tip": "git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'"
|
||||||
}]
|
}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user