..
.TH "GIT-RESET" 1 "" "" ""
.SH NAME
-git-reset \- Reset current HEAD to the specified state.
+git-reset \- Reset current HEAD to the specified state
.SH "SYNOPSIS"
-git\-reset [\-\-mixed | \-\-soft | \-\-hard] [<commit\-ish>]
+\fIgit\-reset\fR [\-\-mixed | \-\-soft | \-\-hard] [<commit\-ish>]
.SH "DESCRIPTION"
.TP
Undo a commit and redo
-.IP
+.nf
$ git commit \&.\&.\&.
$ git reset \-\-soft HEAD^
$ edit
"reset" copies the old head to \&.git/ORIG_HEAD; redo the
commit by starting with its log message\&. If you do not need to
edit the message further, you can give \-C option instead\&.
+.fi
+
.TP
Undo commits permanently
-.IP
+.nf
$ git commit \&.\&.\&.
$ git reset \-\-hard HEAD~3
The last three commits (HEAD, HEAD^, and HEAD~2) were bad
and you do not want to ever see them again\&. Do *not* do this if
you have already given these commits to somebody else\&.
+.fi
+
.TP
Undo a commit, making it a topic branch
-.IP
+.nf
$ git branch topic/wip
$ git reset \-\-hard HEAD~3
$ git checkout topic/wip
current HEAD\&.
Rewind the master branch to get rid of those three commits\&.
Switch to "topic/wip" branch and keep working\&.
+.fi
+
.TP
Undo update\-index
-.IP
+.nf
$ edit
$ git\-update\-index frotz\&.c filfre\&.c
$ mailx
remain there\&.
then you can pull and merge, leaving frotz\&.c and filfre\&.c
changes still in the working tree\&.
+.fi
+
.TP
Undo a merge or pull
-.IP
+.nf
$ git pull
Trying really trivial in\-index merge\&.\&.\&.
fatal: Merge requires file\-level merging
tip of the current branch in ORIG_HEAD, so resetting hard to it
brings your index file and the working tree back to that state,
and resets the tip of the branch to that commit\&.
+.fi
+
.TP
Interrupted workflow
Suppose you are interrupted by an urgent fix request while you are in the middle of a large change\&. The files in your working tree are not in any shape to be committed yet, but you need to get to the other branch for a quick bugfix\&.
-.IP
+.nf
$ git checkout feature ;# you were working in "feature" branch and
$ work work work ;# got interrupted
$ git commit \-a \-m 'snapshot WIP'
After , the index file still has all the WIP changes you
committed in \&. This sets it to the last commit you were
basing the WIP changes on\&.
+.fi
+
.SH "AUTHOR"