Documentation: git-reset - interrupted workflow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 13, 2006 at 13:17 UTC
a0dfb48af73a98ceb60629f2bbc4ebf1393ba0af
1 file changed
+26
-1
Documentation/git-reset.txt
+26
-1
@@ -145,6 +145,32 @@ brings your index file and the working tree back to that state,
145
and resets the tip of the branch to that commit.
146
------------
147
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
+
174
Author
175
------
176
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>.
182
GIT
183
---
184
Part of the gitlink:git[7] suite
159
-