Search code examples
gitmergecommandgit-stash

Git command error


I have updated files in my local instance and my git have 3 days old files. So i want to commit my changes for that i done following command to merge changes in git and my local instance

  1. Sudo git pull --> pulling files from git

So it will give some error like i have some updated files that are not in git , so i want to merge it or not.

2.sudo git stash --> moving my updated files to buffer (saving my changes in buffer)

3.sudo git pull --> pulling old files from git to my local instance again

  1. sudo git stash pop --> merging my local buffer files to local instance( i got old files from git now)

so i got following error

controller.php: needs merge
unable to refresh index

So now my entire local instance turned to set of old files, iam not able to merge my buffer changes to my local instance pls help


Solution

  • You can see a similar error message in "Git stash pop- needs merge, unable to refresh index".

    In your case, you would need to resolve the merge (fixing merge conflicts) in order for the stash to proceed.

    To reset a merged file, the OP used:

    git reset HEAD -- filename