Re: [git-users] newbie question regarding git reset

2011-09-05 Thread Allwyn Carvalho
Konstantin, thanks.

On Mon, Sep 5, 2011 at 12:06 AM, Konstantin Khomoutov
 wrote:
> On Sun, Sep 04, 2011 at 06:19:46PM -0700, Allwyn Carvalho wrote:
>
>> I am a git newbie.  We recently started using git for one of the
>> projects in our company.  Here is a question regarding git reset.
>> Let's say I have done a new pull to update my branch and git log shows
>> the following commits in master: A, B, C, D, E,
>>
>> Let's say I now do a "git reset --hard E".  master's HEAD will be E.
>> Great.  But now let's say I want to go back to setting master's HEAD
>> to A.  Can I simply do "git reset --hard A"?
> Yes.
>
> But note that `git reset --hard` is not something one is expected to use
> to jump between commits in a history: this command repositions the HEAD,
> that is, not merely resets your work tree to the indicated commit but
> first makes the HEAD point to it which is rarely needed).
> If you just want to bring your work tree to the state of a particular
> commit in the history, use `git checkout` (possibly preceded by
> `git stash` if you have a dirty work tree).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Git for human beings" group.
> To post to this group, send email to git-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> git-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/git-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] newbie question regarding git reset

2011-09-05 Thread Konstantin Khomoutov
On Sun, Sep 04, 2011 at 06:19:46PM -0700, Allwyn Carvalho wrote:

> I am a git newbie.  We recently started using git for one of the
> projects in our company.  Here is a question regarding git reset.
> Let's say I have done a new pull to update my branch and git log shows
> the following commits in master: A, B, C, D, E,
> 
> Let's say I now do a "git reset --hard E".  master's HEAD will be E.
> Great.  But now let's say I want to go back to setting master's HEAD
> to A.  Can I simply do "git reset --hard A"?
Yes.

But note that `git reset --hard` is not something one is expected to use
to jump between commits in a history: this command repositions the HEAD,
that is, not merely resets your work tree to the indicated commit but
first makes the HEAD point to it which is rarely needed).
If you just want to bring your work tree to the state of a particular
commit in the history, use `git checkout` (possibly preceded by
`git stash` if you have a dirty work tree).

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.