Skip to content

Commit a0dfb48

Browse files
author
Junio C Hamano
committed
Documentation: git-reset - interrupted workflow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent cb95bf4 commit a0dfb48

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Documentation/git-reset.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,32 @@ brings your index file and the working tree back to that state,
145145
and resets the tip of the branch to that commit.
146146
------------
147147

148+
Interrupted workflow::
149+
+
150+
You can get interrupted by an ungent fix request while you are
151+
still in the middle of a large change. The files in your
152+
working tree are not in any shape to be committed yet, but you
153+
need to get to the other branch for a quick bugfix.
154+
+
155+
------------
156+
$ git checkout feature ;# you were working in "feature" branch and
157+
$ work work work ;# got interrupted
158+
$ git commit -a -m 'snapshot WIP' <1>
159+
$ git checkout master
160+
$ fix fix fix
161+
$ git commit ;# commit with real log
162+
$ git checkout feature
163+
$ git reset --soft HEAD^ ;# go back to WIP state <2>
164+
$ git reset <3>
165+
166+
<1> This commit will get blown away so a throw-away log message is OK.
167+
<2> This removes the 'WIP' commit from the commit history, and makes
168+
your working tree in the state just before you made that snapshot.
169+
<3> After <2>, the index file still has all the WIP changes you
170+
committed in <1>. This sets it to the last commit you were
171+
basing the WIP changes on.
172+
------------
173+
148174
Author
149175
------
150176
Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org>
@@ -156,4 +182,3 @@ Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
156182
GIT
157183
---
158184
Part of the gitlink:git[7] suite
159-

0 commit comments

Comments
 (0)