Create a new branch from your git stash

Sometimes when you have a tonne of changes you realize that you probably want to keep all of them in a new branch instead of as a new commit in the current branch. Normally you would simply do a git stash and then create a new branch and then do a git stash pop. You can reduce this to a single step by the command

git stash branch <new branch name>

Thats it, you instantly have all the changes in your working dir + stage, all checked out into a new branch

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *