File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,32 @@ brings your index file and the working tree back to that state,
145145and 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+
148174Author
149175------
150176Written 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>.
156182GIT
157183---
158184Part of the gitlink:git[7] suite
159-
You can’t perform that action at this time.
0 commit comments