-1

I used the following git commands:

git stash
git pull

After pull, the command line displayed:

Auto-merging ...path/ConflictFile.xxx
CONFLICT (content): Merge conflict in ...path/ConflictFile.xxx
Automatic merge failed; fix conflicts and then commit the result.

I chose "accept incoming changes" for the conflicts in file 1. Now I want out.

But in case it changes an answer to help me understand, running git status now shows this:

Your branch and 'origin/develop' have diverged,
and have 1 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Then it says (note-these are co-worker's files so I don't understand this)

Changes to be committed:
/path/fileHeAdded.xxx
/path/fileHeAdded.xxx
/path/fileHeAdded.xxx
/path/fileHeUpdated.xxx

Then it says:

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   path/ConflictFile.xxx
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        path/OneOfMyUntrackedFiles.xxx
        path/AnotherOfMyUntrackedFiles.xxx

Those last ones ^ make sense because they are files I added yesterday but did not stage.

How do I undo both the stash and pull to get back to where I was before I ran them? I read you can run git merge --abort, but will that remove the stash or will I need to remove that separately?

I just want to get things clean before I learn about the conflicts.

Thanks!

MattoMK
  • 609
  • 1
  • 8
  • 25

1 Answers1

1

To undo

git stash
git pull

Resulting in a merge conflict, say

git merge --abort
git stash pop

Your branch will be exactly where it was before you said those things.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • thanks, i bit the bullet and added the merges and committed those and eventually it worked out. bad timing for high stress learning, the only one around today. big demo tomorrow. i appreciate your answer. – MattoMK Feb 09 '22 at 05:03