[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: difference between "git reset --hard" and "git checkout -f"
From:       Johannes Sixt <j.sixt () viscovery ! net>
Date:       2008-04-30 12:47:51
Message-ID: 48186A77.9040601 () viscovery ! net
[Download RAW message or body]

Miklos Vajna schrieb:
> On Wed, Apr 30, 2008 at 05:07:40PM +0530, Sitaram Chamarty <sitaramc@gmail.com> wrote:
>> (1) as in the subject line, what's the difference between these two
>> commands?  (I'm talking about those exact commands, not variations).
>> I am unable to see any.
> 
> git checkout is the tool to check out a branch or paths. git reset is to
> reset HEAD (and as a side effect the working directory as well). so i
> think only the sematics differ, there is no difference in practice.

Moreover, if you are in the middle of a merge (e.g. when there are merge
conflicts, or after git merge --no-commit), git reset --hard forgets about
the merge, but git checkout -f does not; hence, a git commit after the
latter would create a merge commit, which is usually not what you want.

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic