0

I already have stashed my changes and I can see them when I use git stash list. I did git pull --rebase upstream master successfully. (It had conflict in FileA, I resolved it.) Now I want to get my latest stashed changes at stash@{0}:. So I use git stash apply 0. Its gives me message Merge conflict in .gitignore. I fixed / merged/ resolved conflict in .gitignore.

Then did git stash apply 0, I received same error Merge conflict in .gitignore. This time I again fixed .gitignore, and I committed this .gitignore file hoping it would take care. ( I did look up on stakcoverflow and found exact same issue faced by someone and took steps).

Then I again did git stash apply 0 and same error again in loop. How to get past this error.

After git stash apply , I don't see all my changes that are supposed to be applied from the stash. I just get the conflict message for .gitignore but don't see other changes that I would like to see.

1 Answer 1

1

git stash apply takes the commits that git stash made and attempts to apply (merge) them.

This attempt either succeeds, or stops with a merge conflict:

  • If it succeeds, Git has done its best to apply the stash. View the result (however you like) and if you like it, use git stash drop to discard the stash commits.

  • If it fails, Git has still done its best to apply the stash. View the result, resolve conflicts, and if you like the end result, use git stash drop to discard the stash commits.

In other words, don't keep re-applying the difference between the stashed commits and your current, in-progress work.

Sign up to request clarification or add additional context in comments.

2 Comments

After git stash apply , I don't see all my changes that are supposed to be applied from the stash. I just get the conflict message for .gitignore but don't see other changes that I would like to see.
In that case, you're not happy with the results, so don't drop the stash. Look inside the stash to see what's in it: git stash show (or git stash show 0, same thing, you only need the number when it's not zero). I expect you will see that this stash is not the stash you want; if so, use git stash list and git stash show on each of the other stashes.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.