1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Resolve A Merge Conflict From Stash Pop as a git til

This commit is contained in:
jbranchaud
2021-01-12 11:32:41 -06:00
parent 71e819322d
commit d8034c4ce1
2 changed files with 23 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
_1004 TILs and counting..._
_1005 TILs and counting..._
---
@@ -258,6 +258,7 @@ _1004 TILs and counting..._
- [Rename A Remote](git/rename-a-remote.md)
- [Renaming A Branch](git/renaming-a-branch.md)
- [Resetting A Reset](git/resetting-a-reset.md)
- [Resolve A Merge Conflict From Stash Pop](git/resolve-a-merge-conflict-from-stash-pop.md)
- [Show All Commits For A File Beyond Renaming](git/show-all-commits-for-a-file-beyond-renaming.md)
- [Show Changes For Files That Match A Pattern](git/show-changes-for-files-that-match-a-pattern.md)
- [Show Changes In The Compose Commit Message View](git/show-changes-in-the-compose-commit-message-view.md)

View File

@@ -0,0 +1,21 @@
# Resolve A Merge Conflict From Stash Pop
Occasionally when I've stashed some changes and then `stash pop` them back onto
me working tree, I'll end up with a merge conflict. Either some new commits or
other changes to the working tree are in conflict with what's in the stash. Git
tells me it's up to me to resolve it.
Running `git status`, I can see what files have merge conflicts. I can go and
resolve those now based on what I want the state of my working tree to be.
Running `git status`, I'll also note that the files from the stash not involved
in the conflict have been staged. I don' know why git stages those changes when
a merge conflict arises. When I `stash pop` and there is no merge conflict, git
leaves the changes on the working tree.
This has confused me more than a couple times. Is there anything I need to do
to complete or resolve the `stash pop`?
Nope. Resolving the conflicts in the affected files is all that needs to be
done. And since I'm generally not looking to create a commit at this point, I
_unstage_ the staged changes with `git reset HEAD`.