I did a git stash pop
and ended up with merge conflicts. I removed the files from the file system and did a git checkout
as shown below, but it thinks the files are still unmerged. I then tried replacing the files and doing a git checkout
again and same result. I event tried forcing it with -f
flag. Any help would be appreciated!
chirag-patels-macbook-pro:haloror patelc75$ git status
app/views/layouts/_choose_patient.html.erb: needs merge
app/views/layouts/_links.html.erb: needs merge
# On branch prod-temp
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: db/schema.rb
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# unmerged: app/views/layouts/_choose_patient.html.erb
# unmerged: app/views/layouts/_links.html.erb
chirag-patels-macbook-pro:haloror patelc75$ git checkout app/views/layouts/_choose_patient.html.erb
error: path 'app/views/layouts/_choose_patient.html.erb' is unmerged
chirag-patels-macbook-pro:haloror patelc75$ git checkout -f app/views/layouts/_choose_patient.html.erb
warning: path 'app/views/layouts/_choose_patient.html.erb' is unmerged
See man git merge (HOW TO RESOLVE CONFLICTS):
After seeing a conflict, you can do two things:
Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes made by 2. and 3.; git-reset --hard can be used for this.
Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and git add them to the index. Use git commit to seal the deal.
And under TRUE MERGE (to see what 2. and 3. refers to):
When it is not obvious how to reconcile the changes, the following happens:
The HEAD pointer stays the same.
The MERGE_HEAD ref is set to point to the other branch head.
Paths that merged cleanly are updated both in the index file and in your working tree.
...
So: use git reset --hard
if you want to remove the stash changes from your working tree, or git reset
if you want to just clean up the index and leave the conflicts in your working tree to merge by hand.
Under man git stash (OPTIONS, pop) you can read in addition:
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 git stash drop manually afterwards.