From c25c996061064267369a9910aca6872ffd5846ff Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Sun, 22 Nov 2020 23:33:00 -0500 Subject: [PATCH] git set upstream shortcut --- bin/git_set_upstream | 12 ++++++++++++ fish.configlink/functions/aliases.fish | 1 + 2 files changed, 13 insertions(+) create mode 100644 bin/git_set_upstream diff --git a/bin/git_set_upstream b/bin/git_set_upstream new file mode 100644 index 0000000..d304b9f --- /dev/null +++ b/bin/git_set_upstream @@ -0,0 +1,12 @@ +#!/bin/bash + +# Copied from David Pedersen: https://github.com/davidpdrsn/dotfiles/blob/master/bin/git-pp + +set -e + +function git_branch_name { + val=`git branch 2>/dev/null | grep '^*' | colrm 1 2` + echo "$val" +} + +git push --set-upstream origin $(git_branch_name) diff --git a/fish.configlink/functions/aliases.fish b/fish.configlink/functions/aliases.fish index c8d7e37..cbc4e6c 100644 --- a/fish.configlink/functions/aliases.fish +++ b/fish.configlink/functions/aliases.fish @@ -18,6 +18,7 @@ function aliases --description 'All aliases' abbr -a gc 'git commit -m' abbr -a gu 'git pull' abbr -a gp 'git push' + abbr -a gpp 'git_set_upstream' abbr -a gl 'git log --graph --decorate --oneline -20' abbr -a gll 'git log --graph --decorate --oneline' abbr -a gco 'git checkout'