Last active
August 29, 2015 14:02
-
-
Save lshearer/0d6a8c665a3b075af150 to your computer and use it in GitHub Desktop.
Git custom commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# v0.1.0 | |
# Copyright 2014, Lyle Shearer | |
# MIT License | |
# https://gist.github.com/lshearer/0d6a8c665a3b075af150 | |
# | |
# Using http://blog.santosvelasco.com/2012/06/14/extending-git-add-a-custom-command/ as a guideline | |
# | |
# Creates a new branch based on a freshly fetched origin/master | |
# Usage: | |
# > git new MY_NewBranchName | |
# | |
# Installation: | |
# Copy to `C:\Program Files (x86)\Git\libexec\git-core` (Windows) or similar. File must have no extension. | |
newbranch=$1 | |
test -z $newbranch && echo -e "Branch name required.\nUsage:\n >git new MY_NewBranchName\n" 1>&2 && exit 1 | |
git fetch && git checkout -b $newbranch --no-track origin/master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment