Git “feature branch” alias

git aliases are useful command-line shortcuts to save a minute or two here and there while working with your version-controlled source code (or other data).

Here’s one I’ve been using recently in case it saves you time too. It creates and checks out a new branch based on the latest code in the master branch of the master branch on the origin remote.

To use it, just add the following line to your `~/.gitconfig`

fb = "!git fetch origin && git checkout -t origin/master -b

To use: git fb try/some-new-feature

`fb` is short for “feature branch

2 comments / Add your comment below

    1. Apologies, Lance. I thought I’d replied to this!

      The `!` at the beginning of a git alias means to run the entirety of the command “externally” (as opposed to being a subcommand of git).

      I use it here because this is a composition of more than one git command.

Leave a Reply