Note that there are some explanatory texts on larger screens.

plurals
  1. POGit: How to revert 2 files that are stubbornly stuck at "Changed but not committed"?
    primarykey
    data
    text
    <p>I have a repo that has two files that supposedly I changed locally.</p> <p>So I'm stuck with this:</p> <pre><code>$ git status # On branch master # Changed but not updated: # (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: dir1/foo.aspx # modified: dir2/foo.aspx # no changes added to commit (use "git add" and/or "git commit -a") </code></pre> <p>Doing <code>git diff</code> says that the entire file contents have changed, even though from eyeballing it that seems untrue (there seem to be common line ranges that diff seems to be failing to see).</p> <p>Interestingly I don't remember changing these files locally. This repo is used with one remote repo (private, at GitHub.com, FWIW).</p> <p>No matter what I've tried, I can't discard these local changes. I have tried all of:</p> <pre><code>$ git checkout -- . $ git checkout -f $ git checkout -- dir1/checkout_receipt.aspx $ git reset --hard HEAD $ git stash save --keep-index &amp;&amp; git stash drop $ git checkout-index -a -f </code></pre> <p>In other words I've tried everything described in <a href="https://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git">How do I discard unstaged changes in Git?</a> plus more. But the 2 files remain stuck as "changed but not committed".</p> <p>What the heck would cause two files to be stuck like this and seemingly "un-revert-table"??</p> <p>P.S. In the list above showing commands I'd already tried, I mistakenly wrote <code>git revert</code> when I meant <code>git checkout</code>. I'm sorry and thank you to those of you who answered that I should try <code>checkout</code>. I edited the question to correct it. I definitely did already try <code>checkout</code>.</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.
 

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