Arpit Rawat
Arpit Rawat

Reputation: 1837

git stash pop vs git rebase

I always use git rebase to sync my code, I found that git stash saves the current work and after fetching the latest code from master we can merge it with our code by using git stash pop.

Suppose the sequence is:

I guess this will merge my work with updated code, if instead of git stash pop I will do
git rebase master then the result will be the same or not?

Your suggestion and help will be appreciated, Thanks for your time.

Upvotes: 13

Views: 9600

Answers (1)

poke
poke

Reputation: 387547

The stash is meant to store changes that are not meant to be commited yet. For example if you are working on something that isn't done yet, and you want to work on something else for a while without committing the unfinished work, then you use a stash to store it for later use.

If you however have actual commits, that contain finished work, then use either git merge or git rebase to merge/rebase those commits into the history.

Upvotes: 14

Related Questions