Created
October 11, 2016 22:28
-
-
Save taq/1ef38725c39c041f59701f29a83c7fa3 to your computer and use it in GitHub Desktop.
Git alias to create a new remote branch based on the current branch
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
Just insert on .gitconfig: | |
nrb = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD):$1; }; f" | |
And then, when on a local branch and want to push to a new remote branch called, say, 'test': | |
$ git nbr test | |
Total 0 (delta 0), reused 0 (delta 0) | |
To <your remote here> | |
* [new branch] work -> test | |
Branch work set up to track remote branch test from origin. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment