Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In their simplest form, <code>reset</code> resets the index without touching the working tree, while <code>checkout</code> changes the working tree without touching the index.</p> <p>Resets the index to match <code>HEAD</code>, working tree left alone:</p> <pre><code>git reset </code></pre> <p>Conceptually, this checks out the index into the working tree. To get it to actually do anything you would have to use <code>-f</code> to force it to overwrite any local changes. This is a safety feature to make sure that the "no argument" form isn't destructive:</p> <pre><code>git checkout </code></pre> <p>Once you start adding parameters it is true that there is some overlap.</p> <p><code>checkout</code> is usually used with a branch, tag or commit. In this case it will reset <code>HEAD</code> and the index to the given commit as well as performing the checkout of the index into the working tree.</p> <p>Also, if you supply <code>--hard</code> to <code>reset</code> you can ask <code>reset</code> to overwrite the working tree as well as resetting the index.</p> <p>If you current have a branch checked out out there is a crucial different between <code>reset</code> and <code>checkout</code> when you supply an alternative branch or commit. <code>reset</code> will change the current branch to point at the selected commit whereas <code>checkout</code> will leave the current branch alone but will checkout the supplied branch or commit instead.</p> <p>Other forms of <code>reset</code> and <code>commit</code> involve supplying paths.</p> <p>If you supply paths to <code>reset</code> you cannot supply <code>--hard</code> and <code>reset</code> will only change the index version of the supplied paths to the version in the supplied commit (or <code>HEAD</code> if you don't specify a commit).</p> <p>If you supply paths to <code>checkout</code>, like <code>reset</code> it will update the index version of the supplied paths to match the supplied commit (or <code>HEAD</code>) but it will always checkout the index version of the supplied paths into the working tree.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload