I have my branch on my GIT repository where I used to commit and push. But today I saw a different programmer committed and pushed to my branch. Now when I try to pull the latest branch GIT completes it half way and then gives error "Either commit your changes or stash them". I have no idea what that means and I don't want to commit before taking his latest changes on my branch. How do I solve this issue?
A commit is part of the public git history; a stash is stored locally. A commit creates a new save point on a branch; a stash reverts to a previous save point. A new commit leaves files in the working tree unchanged; a stash resets files in the working tree to the previous commit point.
git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.
It means that you have uncommitted changes, which prevents you from pulling. And you solve it by either committing them or stashing them. Just like the error message says.
It means that you have uncommitted changes, which prevents you from pulling.
And you solve it by either committing them or stashing them. Just like the error message says.
(By the way, you typically get better answers by asking precise questions. If you want to know what git stash
is, ask that. Simply asking "how do I solve the problem where Git tells me to commit or stash" simply leads to answers like "you should commit or stash".
Git itself has already answered your question. If you didn't understand that answer, ask about the part you don't understand.
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