It is possible that I have several branches
--develop
---foo
---bar
And for example, I have changes in foo
, but I want to go to , bar
but WITHOUT committing the changes in foo
, is there a way to save them "temporarily" without the need for them to appear in the commit history ?
You can use
git stash
to upload the changes you haven't madecommit
to, then move to another onebranch
and when you're donebranch
doing what you had to do in that other one, you can go back to thebranch
original and dogit stash apply
.The flow would be like this:
branch develop
and you have no changescomiteados
git stash
git checkout master
git checkout develop
git stash apply
develop
as if nothing had happenedMore information about git stash here .
git stash
It is the utility that can help you the most for this task. SayingThe changes that you have not added to any
commit
will be saved. Once this is done, you can switch frombranch
, etc.When you return to the
branch
original, typing the following will have those files present again:If you ever wonder what you have in your stash, you can type
And you will have information of the type: