Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "commit your changes or stash them" mean?

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?

like image 520
Tim Tom Avatar asked Jun 09 '12 09:06

Tim Tom


People also ask

What does it mean to stash a commit?

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.

What does it mean to stash your changes?

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.

What does it mean to commit your changes?

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.


1 Answers

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.

like image 173
jalf Avatar answered Oct 01 '22 07:10

jalf