File tree 2 files changed +54
-0
lines changed
2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,18 @@ Commands
27
27
* ` git merge-branch` - Pull-Request Merge current Branch to Master
28
28
* ` git create-pr` - Shortcut to push branch and create a pull-request
29
29
30
+ Helpful Aliases
31
+ ---------------
32
+ Add the following aliases to ` .bashrc` , ` .bash_profile` , or ` .zshrc`
33
+
34
+ ` ` ` sh
35
+ alias pr=" git create-pr"
36
+ alias push=" git push-branch"
37
+ alias merge=" git merge-branch"
38
+ alias pr-merge=" git merge-pr"
39
+ ` ` `
40
+
41
+
30
42
Contributors
31
43
------------
32
44
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -e
4
+
5
+ function usage() {
6
+ bold=$( tput bold)
7
+ normal=$( tput sgr0)
8
+ cat << EOF
9
+
10
+ ${bold} NAME${normal}
11
+ git-push-branch - Push the current branch and track remote
12
+
13
+ ${bold} SYNOPSIS${normal}
14
+ git push-branch
15
+
16
+ EOF
17
+ }
18
+
19
+ # actually parse the options and do stuff
20
+ while [[ $1 = -?* ]]; do
21
+ case $1 in
22
+ -h|--help)
23
+ usage
24
+ exit 0
25
+ ;;
26
+ * ) ;;
27
+ esac
28
+ shift
29
+ done
30
+
31
+ branch=$( git rev-parse --abbrev-ref HEAD)
32
+ upstream=$( git rev-parse --abbrev-ref @{upstream} 2> /dev/null)
33
+
34
+ if [[ $? == 0 ]]; then
35
+ echo " branch '$branch ' tracks '$upstream '"
36
+ git push
37
+ else
38
+ echo " branch '$branch ' has no upstream configured"
39
+ git push -u origin $branch
40
+ fi
41
+
42
+
You can’t perform that action at this time.
0 commit comments