mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
Make git undo -s restore the staging area
This commit is contained in:
parent
2590998ee0
commit
b7d507567b
1
AUTHORS
1
AUTHORS
|
|
@ -168,6 +168,7 @@ Patches and Suggestions
|
|||
- Nick Campbell
|
||||
- Nick Payne
|
||||
- Niklas Fiekas
|
||||
- Peter Bittner
|
||||
- Prayag Verma
|
||||
- R. Martinho Fernandes
|
||||
- Raphael Fleischlin
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ EOL
|
|||
;;
|
||||
--hard)
|
||||
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
|
||||
git reset --hard HEAD$back && exit 0;
|
||||
git reset --hard HEAD$back
|
||||
;;
|
||||
-s|--soft)
|
||||
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
|
||||
git reset --soft HEAD$back
|
||||
;;
|
||||
*)
|
||||
test $1 -gt 1 > /dev/null 2>&1 && back="~$1"
|
||||
git reset --soft HEAD$back
|
||||
git reset
|
||||
;;
|
||||
esac
|
||||
|
||||
git reset --soft HEAD$back
|
||||
git reset
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GIT\-UNDO" "1" "April 2018" "" "Git Extras"
|
||||
.TH "GIT\-UNDO" "1" "June 2018" "" "Git Extras"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBgit\-undo\fR \- Remove latest commits
|
||||
|
|
@ -16,7 +16,7 @@ Removes the latest commits\.
|
|||
\-\-soft or \-s
|
||||
.
|
||||
.P
|
||||
This is the default, only rolls back the commit but changes remain un\-staged\.
|
||||
Rolls back the commit(s) but leaves the changes in the staging area\.
|
||||
.
|
||||
.P
|
||||
\-\-hard or \-h
|
||||
|
|
@ -44,6 +44,19 @@ $ git undo
|
|||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Removes the latest commit, restoring the staging area\.
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
$ git undo \-s
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Remove the latest 3 commits:
|
||||
.
|
||||
.IP "" 4
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
<p> --soft or -s</p>
|
||||
|
||||
<p> This is the default, only rolls back the commit but changes remain un-staged.</p>
|
||||
<p> Rolls back the commit(s) but leaves the changes in the staging area.</p>
|
||||
|
||||
<p> --hard or -h</p>
|
||||
|
||||
|
|
@ -104,6 +104,11 @@
|
|||
<pre><code>$ git undo
|
||||
</code></pre>
|
||||
|
||||
<p> Removes the latest commit, restoring the staging area.</p>
|
||||
|
||||
<pre><code>$ git undo -s
|
||||
</code></pre>
|
||||
|
||||
<p> Remove the latest 3 commits:</p>
|
||||
|
||||
<pre><code>$ git undo 3
|
||||
|
|
@ -111,7 +116,7 @@
|
|||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Kenneth Reitz <<a href="mailto:me@kennethreitz.com" data-bare-link="true">me@kennethreitz.com</a>> and Nick Lombard <<a href="mailto:github@jigsoft.co.za" data-bare-link="true">github@jigsoft.co.za</a>></p>
|
||||
<p>Written by Kenneth Reitz <<a href="mailto:me@kennethreitz.com" data-bare-link="true">me@kennethreitz.com</a>> and Nick Lombard <<a href="mailto:github@jigsoft.co.za" data-bare-link="true">github@jigsoft.co.za</a>></p>
|
||||
|
||||
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
|
||||
|
||||
|
|
@ -124,7 +129,7 @@
|
|||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>April 2018</li>
|
||||
<li class='tc'>June 2018</li>
|
||||
<li class='tr'>git-undo(1)</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ git-undo(1) -- Remove latest commits
|
|||
|
||||
--soft or -s
|
||||
|
||||
This is the default, only rolls back the commit but changes remain un-staged.
|
||||
Rolls back the commit(s) but leaves the changes in the staging area.
|
||||
|
||||
--hard or -h
|
||||
|
||||
|
|
@ -30,6 +30,10 @@ git-undo(1) -- Remove latest commits
|
|||
|
||||
$ git undo
|
||||
|
||||
Removes the latest commit, restoring the staging area.
|
||||
|
||||
$ git undo -s
|
||||
|
||||
Remove the latest 3 commits:
|
||||
|
||||
$ git undo 3
|
||||
|
|
|
|||
Loading…
Reference in a new issue