← back to all talks and articles

Using git stash branch

When using Git I sometimes end up with a bunch of changes that would really be better off in a feature branch. Here’s a quick way to take those changes in your working copy and start a feature branch quickly:

git stash
git stash branch my_branch_title

From the docs on git stash branch:

Creates and checks out a new branch named <branchname> starting from the commit at which the <stash> was originally created, applies the changes recorded in <stash> to the new working tree and index, then drops the <stash> if that completes successfully. When no <stash> is given, applies the latest one.

Awesome.

  • code
  • git
Arjan van der Gaag

Arjan van der Gaag

A thirtysomething software developer, historian and all-round geek. This is his blog about Ruby, Rails, Javascript, Git, CSS, software and the web. Back to all talks and articles?

Discuss

You cannot leave comments on my site, but you can always tweet questions or comments at me: @avdgaag.