Reputation: 1924
I have a cherry-picked commit and local working tree changes on top of it. I want stash these both so that I can switch HEAD to parent commit temporarily and then return it back to previous state. Is it possible to do this without creating a branch?
Upvotes: 0
Views: 40
Reputation: 23142
You don't necessarily need to create a new branch (although it's cheap and I wouldn't hesitate to create one).
The quickest way I can think of is the following (assuming your branch is called master
):
$ git stash
$ git checkout HEAD^
Do stuff on parent commit...
Then return:
$ git checkout master
$ git stash pop
Upvotes: 1