Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between git stash save and git stash push?

Tags:

git

git-stash

When should I use git stash save instead of git stash push and vice-versa?

like image 447
David Burson Avatar asked Jun 21 '17 15:06

David Burson


People also ask

What is git stash push?

When you 'git stash', it will get saved/pushed in a 'STACK' type temporary location (let's call that stash-list) so that you can pop/apply them later. The latest stash will be stored in refs/stash . And the subsequent pushes will be available in the reflog of this reference.

What does git stash save do?

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.

Does git stash save all changes?

Git stash saves the uncommitted changes locally, allowing you to make changes, switch branches, and perform other Git operations. You can then reapply the stashed changes when you need them. A stash is locally scoped and is not pushed to the remote by git push .

What is difference between git stash pop and git stash apply?

git stash apply vs pop : They are almost similar except the fact that git stash pop throws away the (topmost, by default) stash when applying it, whereas git stash apply leaves it within the stash list for possible later use (or you'll then git stash drop it).


1 Answers

git stash save accepts a single non-option argument — the stash message.

git stash push accepts the message with option -m and accepts a list of files to stash as arguments.

like image 118
phd Avatar answered Sep 19 '22 15:09

phd