Visual git guide (reset command)
Published in:2014-07-07 | Category: Tools
Words: 171 | Reading time: 1min | Reading:

Note: the original website address in here

Reset command

The reset command moves the current branch to another position, and optionally updates the stage and the working directory. It also is used to copy files from the history to the stage without touching the working directory.

If a commit is given with no filenames, the current branch is moved to that commit, and then the stage is updated to match this commit. If –hard is given, the working directory is also updated. If –soft is given, neither is updated.

reset-commit

If a commit is not given, it defaults to HEAD. In this case, the branch is not moved, but the stage (and optionally the working directory, if –hard is given) are reset to the contents of the last commit.

reset

If a filename (and/or -p) is given, then the command works similarly to checkout with a filename, except only the stage (and not the working directory) is updated. (You may also specify the commit from which to take files, rather than HEAD.)

reset-files

Prev:
Visual git guide (technical notes)
Next:
Visual git guide (rebase command)