Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:19:30+00:00 2026-05-16T15:19:30+00:00

I’ve always thought of git reset and git checkout as the same, in the

  • 0

I’ve always thought of git reset and git checkout as the same, in the sense that both bring the project back to a specific commit. However, I feel they can’t be exactly the same, as that would be redundant. What is the actual difference between the two? I’m a bit confused, as the svn only has svn co to revert the commit.

ADDED

VonC and Charles explained the differences between git reset and git checkout really well. My current understanding is that git reset reverts all of the changes back to a specific commit, whereas git checkout more or less prepares for a branch. I found the following two diagrams quite useful in coming to this understanding:

http://a.imageshack.us/img651/1559/86421927.png
http://a.imageshack.us/img801/1986/resetr.png

ADDED 3

From http://think-like-a-git.net/sections/rebase-from-the-ground-up/using-git-cherry-pick-to-simulate-git-rebase.html, checkout and reset can emulate the rebase.

enter image description here

git checkout bar 
git reset --hard newbar 
git branch -d newbar 

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:19:30+00:00Added an answer on May 16, 2026 at 3:19 pm
    • git reset is specifically about updating the index, moving the HEAD.
    • git checkout is about updating the working tree (to the index or the specified tree). It will update the HEAD only if you checkout a branch (if not, you end up with a detached HEAD).
      (actually, with Git 2.23 Q3 2019, this will be git restore, not necessarily git checkout)

    By comparison, since svn has no index, only a working tree, svn checkout will copy a given revision on a separate directory.
    The closer equivalent for git checkout would:

    • svn update (if you are in the same branch, meaning the same SVN URL)
    • svn switch (if you checkout for instance the same branch, but from another SVN repo URL)

    All those three working tree modifications (svn checkout, update, switch) have only one command in git: git checkout.
    But since git has also the notion of index (that "staging area" between the repo and the working tree), you also have git reset.


    Thinkeye mentions in the comments the article "Reset Demystified ".

    For instance, if we have two branches, ‘master‘ and ‘develop‘ pointing at different commits, and we’re currently on ‘develop‘ (so HEAD points to it) and we run git reset master, ‘develop‘ itself will now point to the same commit that ‘master‘ does.

    On the other hand, if we instead run git checkout master, ‘develop‘ will not move, HEAD itself will. HEAD will now point to ‘master‘.

    So, in both cases we’re moving HEAD to point to commit A, but how we do so is very different. reset will move the branch HEAD points to, checkout moves HEAD itself to point to another branch.

    http://git-scm.com/images/reset/reset-checkout.png

    On those points, though:

    LarsH adds in the comments:

    The first paragraph of this answer, though, is misleading: "git checkout … will update the HEAD only if you checkout a branch (if not, you end up with a detached HEAD)".
    Not true: git checkout will update the HEAD even if you checkout a commit that’s not a branch (and yes, you end up with a detached HEAD, but it still got updated).

    git checkout a839e8f updates HEAD to point to commit a839e8f.
    

    De Novo concurs in the comments:

    @LarsH is correct.
    The second bullet has a misconception about what HEAD is in will update the HEAD only if you checkout a branch.
    HEAD goes wherever you are, like a shadow.
    Checking out some non-branch ref (e.g., a tag), or a commit directly, will move HEAD. Detached head doesn’t mean you’ve detached from the HEAD, it means the head is detached from a branch ref, which you can see from, e.g., git log --pretty=format:"%d" -1.

    • Attached head states will start with (HEAD ->,
    • detached will still show (HEAD, but will not have an arrow to a branch ref.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.