File tree Expand file tree Collapse file tree 12 files changed +53
-25
lines changed Expand file tree Collapse file tree 12 files changed +53
-25
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,20 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
8
8
ARCHIVE_NAME=$( basename $( pwd) )
9
9
10
10
if [[ $BRANCH = tags* ]]; then
11
- BRANCH=$( git describe)
12
- echo Building for tag \" $BRANCH \"
13
- FILENAME=$ARCHIVE_NAME .$BRANCH .zip
11
+ BRANCH=$( git describe)
12
+ echo Building for tag \" $BRANCH \"
13
+ FILENAME=$ARCHIVE_NAME .$BRANCH .zip
14
14
else
15
- echo Building archive on branch \" $BRANCH \"
16
- # get a version string, so archives will not be overwritten when creating
17
- # many of them
18
- VERSION=$( git describe --always --long)
19
- # if not on master append branch name into the filename
20
- if [ " $BRANCH " = " master " ]; then
21
- FILENAME=$ARCHIVE_NAME .$VERSION .zip
22
- else
23
- FILENAME=$ARCHIVE_NAME .$VERSION .$BRANCH .zip
24
- fi
15
+ echo Building archive on branch \" $BRANCH \"
16
+ # get a version string, so archives will not be overwritten when creating
17
+ # many of them
18
+ VERSION=$( git describe --always --long)
19
+ # if not on master append branch name into the filename
20
+ if [ " $BRANCH " = $( git_extra_default_branch ) ]; then
21
+ FILENAME=$ARCHIVE_NAME .$VERSION .zip
22
+ else
23
+ FILENAME=$ARCHIVE_NAME .$VERSION .$BRANCH .zip
24
+ fi
25
25
fi
26
26
27
27
# rename invalid chars for the file path
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- branches=$( git branch --no-color --merged | grep -v " \*" | grep -v master | grep -v svn)
3
+ branches=$( git branch --no-color --merged | grep -v " \*" | grep -v $( git_extra_default_branch ) | grep -v svn)
4
4
if [ -n " $branches " ]
5
5
then
6
6
echo " $branches " | xargs -n 1 git branch -d
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- branch=master
3
+ branch=$( git_extra_default_branch )
4
4
filter=ACM
5
5
6
6
if test $# -eq 1; then
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ repository from scratch.
22
22
changed files will be reset, local branches and other remotes will be removed.
23
23
24
24
OPTIONS:
25
- -b, --branch The branch to pull from the remote (default: master)
25
+ -b, --branch The branch to pull from the remote
26
26
-h, --help Display this help message
27
27
"
28
28
}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ echo " create pull-request for $project '$branch'"
64
64
echo
65
65
printf " title: " && read -r title
66
66
printf " body: " && read -r body
67
- printf " base [master ]: " && read -r base
67
+ printf " base [%s ]: " " $( git_extra_default_branch ) " && read -r base
68
68
printf " GitHub two-factor authentication code (leave blank if not set up): " && read -r mfa_code
69
69
echo
70
70
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- git branch --no-color --merged | grep -v " \*" | grep -v master | tr -d ' '
3
+ git branch --no-color --merged | grep -v " \*" | grep -v $( git_extra_default_branch ) | tr -d ' '
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- git branch --no-color --no-merged | grep -v " \*" | grep -v master | tr -d ' '
3
+ git branch --no-color --no-merged | grep -v " \*" | grep -v $( git_extra_default_branch ) | tr -d ' '
Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ commit_if_msg_provided() {
43
43
fi
44
44
}
45
45
46
- prompt_continuation_if_squashing_master () {
47
- if [[ $src =~ ^master$ ]]; then
46
+ prompt_continuation_if_squashing_default_branch () {
47
+ if [[ $src == $( git_extra_default_branch ) ]]; then
48
48
read -p " Warning: squashing '$src '! Continue [y/N]? " -r
49
49
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
50
50
echo " Exiting"
@@ -54,7 +54,7 @@ prompt_continuation_if_squashing_master() {
54
54
}
55
55
56
56
squash_branch () {
57
- prompt_continuation_if_squashing_master
57
+ prompt_continuation_if_squashing_default_branch
58
58
if [ -n " $SQUASH_MSG " ]; then
59
59
base=$( git merge-base " $src " @)
60
60
msg=$( git log " $base " .." $src " --format=" %s%n%n%b" --no-merges --reverse)
Original file line number Diff line number Diff line change @@ -5,3 +5,12 @@ git_extra_mktemp() {
5
5
mktemp -t "$(basename "$0")".XXXXXXX
6
6
}
7
7
8
+ git_extra_default_branch() {
9
+ local default_branch
10
+ default_branch=$(git config --get git-extras.default-branch)
11
+ if [ -z "$default_branch" ]; then
12
+ echo "master"
13
+ else
14
+ echo "$default_branch"
15
+ fi
16
+ }
Original file line number Diff line number Diff line change 1
1
.\" generated with Ronn/v0.7.3
2
2
.\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
.
4
- .TH "GIT\- EXTRAS" "1" "August 2020" "" "Git Extras"
4
+ .TH "GIT\- EXTRAS" "1" "September 2020" "" "Git Extras"
5
5
.
6
6
.SH "NAME"
7
7
\fB git \- extras \fR \- Awesome GIT utilities
@@ -27,6 +27,12 @@ update
27
27
.P
28
28
Self update\.
29
29
.
30
+ .SH "ENVIRONMENT AND CONFIGURATION VARIABLES"
31
+ \fB git config \-\- add git \- extras \. default \- branch $BRANCH \fR
32
+ .
33
+ .P
34
+ Change the default branch to \fB $BRANCH \fR (defaut to \fB master \fR )\.
35
+ .
30
36
.SH "COMMANDS"
31
37
.
32
38
.IP " \(bu " 4
You can’t perform that action at this time.
0 commit comments