I am using GitHub desktop and git command line (to basically stash my code when I need to make a commit on another branch). I use git stash save
and save my code. I then update another branch and switch back to my testing branch which i update to master. I then unstash my code with
git stash pop
This is the output after I ran git stash pop:
Auto-merging update_registration.php
CONFLICT (content):
Merge conflict in update_registration.php
The stash entry is kept in case you need it again.
But then I end up with
<<<<<<< Updated upstream
//Code and whatnot
=======
<<<<<<< Updated upstream
>>>>>>> Stashed changes
in my files and it is quite frustrating truing to manage the code and delete all these lines from my code to upload it to the server.
Am I using git stash wrong?
Thanks
git stash pop
does not restore the files you changed, but the changes you made. If the changes failed to apply (thus asking for messages), you need to merge them manually. That is what those===
,<<<
and>>>
lines tell you.git stash apply
? Right I do want to just restore the changes that I made before I left. This is the output after I rangit stash pop: Auto-merging update_registration.php CONFLICT (content): Merge conflict in update_registration.php The stash entry is kept in case you need it again.
So I just need to figure out how to merge manually then?====
lines. Then you have three choices: 1: Pick the variant above the line (between<<<
and===
), 2: Pick the variant below the line (between===
and>>>
), 3: Pick the one that mostly fits, making changes. In any case remove all those<<<
,>>>
and===
lines. There are merge tools, but that's a different topic. Best try to minimize the need for merges.