Could you show us how you ran checkout? It’s strange to me it staged your
file.

If you have a file in the index and adding modifications makes the file
disappear, that means the changes added later negates the changes in the
index.

Try it: add a line to an unmodified file, add to the index. Now remove the
file and add again. The index is now empty. This is Git’s way to prevent
you making empty commits.

If I were you, I would do the checkout again, and check the contents of the
index with git diff --cached. That may give you a hint on what’s going on.

Gergely

On Tue, Mar 21, 2017, 05:07 AD S <a...@radianweb.com.au> wrote:

> I made a mistake in the code on a file on a remote repo and so used
> `checkout` to bring it into my branch to fix it. Running `git status`
> immediately after, I see the file is modified and staged.
>
> I then make my changes to fix the code and run `git status` again and see
> 2 'versions' of the same file - one staged and one not. Makes sense, all I
> got to do is `git add` the unstaged one and it will update the one in stage.
>
> I do this and `git status` again but now stage is now empty. I get the
> message `nothing to commit (working directory clean)`.
>
> To experiment, I run through the commit, push, merge process and check the
> remote repo, but, of course, the buggy code is still there.
>
> Would anyone know what's going on here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to