Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No, there doesn't seem to be any difference.<br> It is more to illustrate the <code>git reset --soft</code> (i.e. moving HEAD only, which can <a href="https://stackoverflow.com/a/5203843/6309">have other more practical uses</a>)</p> <p><code>git reset HEAD</code> is for "unstaging", and a simple <code>git reset HEAD^</code> does both (move the HEAD, and unstage, no need for <code>--mixed</code>, since it is the default option)</p> <hr> <p>Here is a quick test to see what that looks like:</p> <p>Before (you just switch back to feature, where you committed a "<code>wip</code>" -- work in progress):</p> <pre><code>C:\Users\VonC\prog\git\test\r\r3&gt;gl * 6ac95bd - (origin/master, origin/HEAD, master) fix in master (2 minutes ago) &lt;VonC&gt; | * fd8d97d - (HEAD, origin/feature, feature) snap WIP (3 minutes ago) &lt;VonC&gt; | * 16066dd - f1 (3 minutes ago) &lt;VonC&gt; |/ * e8ad96f - f1 (3 minutes ago) &lt;VonC&gt; </code></pre> <p>The reset itself:</p> <pre><code>C:\Users\VonC\prog\git\test\r\r3&gt;git reset "HEAD^" Unstaged changes after reset: M f </code></pre> <p>That gives you the status:</p> <pre><code>C:\Users\VonC\prog\git\test\r\r3&gt;git st # On branch feature # Your branch is behind 'origin/feature' by 1 commit, and can be fast-forwarded. # (use "git pull" to update your local branch) # # Changes not staged for commit: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;..." to discard changes in working directory) # # modified: f # no changes added to commit (use "git add" and/or "git commit -a") </code></pre> <p>log after <code>git reset HEAD^</code></p> <pre><code>C:\Users\VonC\prog\git\test\r\r3&gt;gl * 6ac95bd - (origin/master, origin/HEAD, master) fix in master (6 minutes ago) &lt;VonC&gt; | * fd8d97d - (origin/feature) snap WIP (7 minutes ago) &lt;VonC&gt; | * 16066dd - (HEAD, feature) f1 (7 minutes ago) &lt;VonC&gt; |/ * e8ad96f - f1 (8 minutes ago) &lt;VonC&gt; </code></pre> <hr> <p>In two steps, you would have seen the following log after the <code>git reset --soft HEAD^</code>:</p> <pre><code>C:\Users\VonC\prog\git\test\r\r2&gt;gl * 6ac95bd - (origin/master, origin/HEAD, master) fix in master (65 seconds ago) &lt;VonC&gt; | * fd8d97d - (origin/feature) snap WIP (89 seconds ago) &lt;VonC&gt; | * 16066dd - (HEAD, feature) f1 (2 minutes ago) &lt;VonC&gt; |/ * e8ad96f - f1 (2 minutes ago) &lt;VonC&gt; </code></pre> <p>You index would still reflect what was staged for <code>wip</code>:</p> <pre><code>C:\Users\VonC\prog\git\test\r\r2&gt;git st # On branch feature # Your branch is behind 'origin/feature' by 1 commit, and can be fast-forwarded. # (use "git pull" to update your local branch) # # Changes to be committed: # (use "git reset HEAD &lt;file&gt;..." to unstage) # # modified: f # </code></pre> <p>The reset would then unstaged, bringing you back to the same stage than a <code>git reset HEAD^</code> would have in one step:</p> <pre><code>C:\Users\VonC\prog\git\test\r\r2&gt;git reset Unstaged changes after reset: M f C:\Users\VonC\prog\git\test\r\r2&gt;git st # On branch feature # Your branch is behind 'origin/feature' by 1 commit, and can be fast-forwarded. # (use "git pull" to update your local branch) # # Changes not staged for commit: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;..." to discard changes in working directory) # # modified: f # no changes added to commit (use "git add" and/or "git commit -a") </code></pre>
    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. 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.
 

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