Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: abouy git reset command

From: David Tweed <hidden>
Date: 2016-06-15 22:44:36

On Tue, May 13, 2008 at 8:07 AM, amishera [off-list ref] wrote:
Moreover, can any body tell me the use of

git reset --soft
Jakub answered about "git reset --soft" on its own, so I'll just
mention the situation I use, say, "git reset --soft HEAD~5" which is:
suppose you realise that you made a really bad mistake 5 commits ago
(say some obscure bug that could cause data loss) and you've just
discovered and fixed it in your working tree (checking in bits to the
index). You don't want to risk ever running a version of your program
built from any of those commits. What you really _ought_ to do is
essentially redo those 5 commits removing the bug, but depending how
rigorous and time constrained your development is you might just want
to commit your new fixed state with one big change log. "git reset
--soft HEAD~5" moves HEAD back five commits but leaves your working
tree and index alone, so the next "git commit" will commit your fixed
current state after the new HEAD. It's clearly not what you want to do
if you're working in a careful development team, but I find it useful
on rare occasions.

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help