After git stash pop
, there were some conflicts, things like:
<<<<<<< Updated upstream
int foo = 5;
=======
int foo = 6;
>>>>>>> Stashed changes
I resolved them in the code, but now I can't preview my changes before committing them. All I get is this, and I know there are changes:
diff --cc mainwindow.cpp
index 24dc025,2c44ad8..0000000
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
How do I force git diff to compare my current source to the last commit?
You can re-apply the changes that you just stashed by using the git stash command. To apply the commit, use the git stash command, followed by the apply option.
When the pop command runs, it's expected that files from the stash will overwrite the contents of the files in the local working tree, and the updated files will be staged in the git index.
If you made two stashes, then just call git stash pop twice. As opposed to git stash apply , pop applies and removes the latest stash. You can also reference a specific stash, e.g.
Your pop
resulted in a merge conflict. In order to resolve it, you need to edit the file (which you already did) and then call git add mainwindow.cpp
to tell git, that you have resolved the conflict.
If you want to preview your changes, you can do so with git diff --cached
. This is because git add
already added your changes to the index.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With