/kb

personal knowledgebase

Archive for the ‘git’ tag

Git: Start a new branch after making changes

without comments

Sometimes I realize that my latest changes actually should belong to another branch than the one I’m currently working on. The easy way to add the changes to a new branch is to use the stash command.

[… changes …]
git stash
git stash branch name_of_new_branch
git commit []
git push origin name_of_new_branch

Ref. git stash.

Written by hgrimelid

April 23rd, 2010 at 12:39 pm

Posted in Programming,Shell

Tagged with