Performing git reset --hard
will only affect those files, Git knows about; those that are currently tracked by Git.
When you take the output of git status
as a reference, what git reset --hard
affects are only those files for which Git has detected modifications which are either staged or not staged. Files listed in the untracked section, and as such are not “known by Git”, are not affected.
So in your case, you have an untracked file OUTPUT_RESULTS_DIR/equity.csv
. Doing git reset --hard
will not affect it, so it stays where it is. However, the branch dev1.1
you attempt to check out, apparently contains that file. So here, Git will protect you from accidentally losing the content of your local file by preventing you from checking out.
At this point, you could rename the file so that you still have it around but it won’t cause a conflict when checking out the other branch. You could also use git checkout dev1.1 --force
to force Git to check out the branch, ignoring any conflicts. However note, that this action cannot be undone, so be careful with it.