scatterd-dotfiles/bin/git-create-branch
Dan Croak 24b34d1bec Move Git aliases to subcommand scripts
Any executable script on you PATH
that is named `git-some-name`
will be available as a git subcommand,
which means you could do `git some-name` to run the script.

Git adds them to `git help -a` under the title
"git commands available from elsewhere on your $PATH",
which will then power the auto completion,
so that will also work for any command you add.

http://blog.zamith.pt/blog/2014/11/05/supercharging-your-git/

Examples of other projects that structure their dotfiles like this:

https://github.com/robbyrussell/oh-my-zsh
https://github.com/tj/git-extras
https://github.com/holman/dotfiles
2015-04-27 13:47:52 -07:00

9 lines
132 B
Bash
Executable file

#!/bin/sh
set -e
git push origin "HEAD:refs/heads/$1"
git fetch origin
git branch --track "$1" "origin/$1"
cd .
git checkout "$1"