On Tue, 12 May 2015 20:34:01 -0700
Michael <[email protected]> wrote:
[...]
> I'm just not understanding the git reset -- it seems to not just
> change the active branch, and possibly the working tree/cached for
> commit, but also alters where branch label point.
>
> That seems to be non-documented, and ... confusing.
Well, `git reset` is completely documented in its manual page
(try running `git help reset`). The problem with this command is that
it gathers several modes of operation under the same name.
The general distinction is this:
* Two ways to call `git reset` make it to do a job essentially reverse
to that of `git add`. In this mode, `git reset` operates on the index
only.
These two ways to call `git reset` are:
git reset foo.js
to unstage the changes made to foo.js and added to the index by
calling `git add foo.js`. In more strict terms, this command sets
the index entry for the file foo.js to the contents it has at the
HEAD revision. You can specify a revision other than HEAD, if you
want. You can specify several files as well.
git reset --patch foo.js
Runs you through an interactive hunk-by-hunk "unstaging" which is just
like `git add --patch foo.js` but it removes the hunks from the index
rather than adding them. This command can be run with no files
specified and then it works on the whole index.
* Anothe three ways to call `git reset` affect the currently checked out
branch and possibly also the index and the work tree -- that's why
there are three of them.
These modes are selected by a special command line option: --soft,
--hard or --mixed, with the latter being the default.
The --soft option only repositions the branch's tip, the --mixed
option performs what the --soft does and also resets the index to
match the new tip. --hard does everything --mixed does and also
resets the work tree to match the new content of the index.
All this is documented in the manual page but the manual is, well,
a manual -- it's for strictly documenting, not for explaining from a
general standpoint -- that's what books and tutorials are for.
Hence I recommend you [1] and [2] to grasp the concepts in a non-manual
way.
1. http://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified
2. http://threetrees.herokuapp.com/
--
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.