Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Suppose you have this scenario where you stash your changes in order to pull from origin. Possibly because your local changes are just <code>debug: true</code> in some settings file. Now you pull and someone has introduced a new setting there, creating a conflict.</p> <p><code>git status</code> says:</p> <pre><code># On branch master # Unmerged paths: # (use "git reset HEAD &lt;file&gt;..." to unstage) # (use "git add/rm &lt;file&gt;..." as appropriate to mark resolution) # # both modified: src/js/globals.tpl.js no changes added to commit (use "git add" and/or "git commit -a") </code></pre> <p>Okay. I decided to go with what Git suggested: I resolved the conflict and committed:</p> <pre><code>vim src/js/globals.tpl.js # type type type … git commit -a -m WIP # (short for "work in progress") </code></pre> <p>Now my working copy is in the state I want, but I have created a commit that I don't want to have. How do I get rid of that commit without modifying my working copy? Wait, there's a popular command for that!</p> <pre><code>git reset HEAD^ </code></pre> <p>My working copy has not been changed, but the WIP commit is gone. That's exactly what I wanted! (Note that I'm not using <code>--soft</code> here, because if there are auto-merged files in your stash, they are auto-staged and thus you'd end up with these files being staged again after <code>reset</code>.)</p> <p>But there's one more thing left: The man page for <code>git stash pop</code> reminds us that <em>"Applying the state can fail with conflicts; in this case, it is not removed from the stash list. You need to resolve the conflicts by hand and call <code>git stash drop</code> manually afterwards."</em> So that's exactly what we do now:</p> <pre><code>git stash drop </code></pre> <p>And done.</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.
 

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