mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
parent
e9668cc04b
commit
964663f1a4
|
|
@ -8,20 +8,20 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
|||
ARCHIVE_NAME=$(basename $(pwd))
|
||||
|
||||
if [[ $BRANCH = tags* ]]; then
|
||||
BRANCH=$(git describe)
|
||||
echo Building for tag \"$BRANCH\"
|
||||
FILENAME=$ARCHIVE_NAME.$BRANCH.zip
|
||||
BRANCH=$(git describe)
|
||||
echo Building for tag \"$BRANCH\"
|
||||
FILENAME=$ARCHIVE_NAME.$BRANCH.zip
|
||||
else
|
||||
echo Building archive on branch \"$BRANCH\"
|
||||
# get a version string, so archives will not be overwritten when creating
|
||||
# many of them
|
||||
VERSION=$(git describe --always --long)
|
||||
# if not on master append branch name into the filename
|
||||
if [ "$BRANCH" = "master" ]; then
|
||||
FILENAME=$ARCHIVE_NAME.$VERSION.zip
|
||||
else
|
||||
FILENAME=$ARCHIVE_NAME.$VERSION.$BRANCH.zip
|
||||
fi
|
||||
echo Building archive on branch \"$BRANCH\"
|
||||
# get a version string, so archives will not be overwritten when creating
|
||||
# many of them
|
||||
VERSION=$(git describe --always --long)
|
||||
# if not on master append branch name into the filename
|
||||
if [ "$BRANCH" = $(git_extra_default_branch) ]; then
|
||||
FILENAME=$ARCHIVE_NAME.$VERSION.zip
|
||||
else
|
||||
FILENAME=$ARCHIVE_NAME.$VERSION.$BRANCH.zip
|
||||
fi
|
||||
fi
|
||||
|
||||
# rename invalid chars for the file path
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
branches=$(git branch --no-color --merged | grep -v "\*" | grep -v master | grep -v svn)
|
||||
branches=$(git branch --no-color --merged | grep -v "\*" | grep -v $(git_extra_default_branch) | grep -v svn)
|
||||
if [ -n "$branches" ]
|
||||
then
|
||||
echo "$branches" | xargs -n 1 git branch -d
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
branch=master
|
||||
branch=$(git_extra_default_branch)
|
||||
filter=ACM
|
||||
|
||||
if test $# -eq 1; then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ repository from scratch.
|
|||
changed files will be reset, local branches and other remotes will be removed.
|
||||
|
||||
OPTIONS:
|
||||
-b, --branch The branch to pull from the remote (default: master)
|
||||
-b, --branch The branch to pull from the remote
|
||||
-h, --help Display this help message
|
||||
"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ echo " create pull-request for $project '$branch'"
|
|||
echo
|
||||
printf " title: " && read -r title
|
||||
printf " body: " && read -r body
|
||||
printf " base [master]: " && read -r base
|
||||
printf " base [%s]: " "$(git_extra_default_branch)" && read -r base
|
||||
printf " GitHub two-factor authentication code (leave blank if not set up): " && read -r mfa_code
|
||||
echo
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git branch --no-color --merged | grep -v "\*" | grep -v master | tr -d ' '
|
||||
git branch --no-color --merged | grep -v "\*" | grep -v $(git_extra_default_branch) | tr -d ' '
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git branch --no-color --no-merged | grep -v "\*" | grep -v master | tr -d ' '
|
||||
git branch --no-color --no-merged | grep -v "\*" | grep -v $(git_extra_default_branch) | tr -d ' '
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ commit_if_msg_provided() {
|
|||
fi
|
||||
}
|
||||
|
||||
prompt_continuation_if_squashing_master() {
|
||||
if [[ $src =~ ^master$ ]]; then
|
||||
prompt_continuation_if_squashing_default_branch() {
|
||||
if [[ $src == $(git_extra_default_branch) ]]; then
|
||||
read -p "Warning: squashing '$src'! Continue [y/N]? " -r
|
||||
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Exiting"
|
||||
|
|
@ -54,7 +54,7 @@ prompt_continuation_if_squashing_master() {
|
|||
}
|
||||
|
||||
squash_branch() {
|
||||
prompt_continuation_if_squashing_master
|
||||
prompt_continuation_if_squashing_default_branch
|
||||
if [ -n "$SQUASH_MSG" ]; then
|
||||
base=$(git merge-base "$src" @)
|
||||
msg=$(git log "$base".."$src" --format="%s%n%n%b" --no-merges --reverse)
|
||||
|
|
|
|||
|
|
@ -5,3 +5,12 @@ git_extra_mktemp() {
|
|||
mktemp -t "$(basename "$0")".XXXXXXX
|
||||
}
|
||||
|
||||
git_extra_default_branch() {
|
||||
local default_branch
|
||||
default_branch=$(git config --get git-extras.default-branch)
|
||||
if [ -z "$default_branch" ]; then
|
||||
echo "master"
|
||||
else
|
||||
echo "$default_branch"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GIT\-EXTRAS" "1" "August 2020" "" "Git Extras"
|
||||
.TH "GIT\-EXTRAS" "1" "September 2020" "" "Git Extras"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBgit\-extras\fR \- Awesome GIT utilities
|
||||
|
|
@ -27,6 +27,12 @@ update
|
|||
.P
|
||||
Self update\.
|
||||
.
|
||||
.SH "ENVIRONMENT AND CONFIGURATION VARIABLES"
|
||||
\fBgit config \-\-add git\-extras\.default\-branch $BRANCH\fR
|
||||
.
|
||||
.P
|
||||
Change the default branch to \fB$BRANCH\fR (defaut to \fBmaster\fR)\.
|
||||
.
|
||||
.SH "COMMANDS"
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
<a href="#NAME">NAME</a>
|
||||
<a href="#SYNOPSIS">SYNOPSIS</a>
|
||||
<a href="#OPTIONS">OPTIONS</a>
|
||||
<a href="#ENVIRONMENT-AND-CONFIGURATION-VARIABLES">ENVIRONMENT AND CONFIGURATION VARIABLES</a>
|
||||
<a href="#COMMANDS">COMMANDS</a>
|
||||
<a href="#AUTHOR">AUTHOR</a>
|
||||
<a href="#REPORTING-BUGS">REPORTING BUGS</a>
|
||||
|
|
@ -91,6 +92,12 @@
|
|||
|
||||
<p> Self update.</p>
|
||||
|
||||
<h2 id="ENVIRONMENT-AND-CONFIGURATION-VARIABLES">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
|
||||
|
||||
<p> <code>git config --add git-extras.default-branch $BRANCH</code></p>
|
||||
|
||||
<p> Change the default branch to <code>$BRANCH</code> (defaut to <code>master</code>).</p>
|
||||
|
||||
<h2 id="COMMANDS">COMMANDS</h2>
|
||||
|
||||
<ul>
|
||||
|
|
@ -165,7 +172,7 @@
|
|||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Tj Holowaychuk <<a href="mailto:tj@vision-media.ca" data-bare-link="true">tj@vision-media.ca</a>></p>
|
||||
<p>Written by Tj Holowaychuk <<a href="mailto:tj@vision-media.ca" data-bare-link="true">tj@vision-media.ca</a>></p>
|
||||
|
||||
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
|
||||
|
||||
|
|
@ -178,7 +185,7 @@
|
|||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>August 2020</li>
|
||||
<li class='tc'>September 2020</li>
|
||||
<li class='tr'>git-extras(1)</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ git-extras(1) -- Awesome GIT utilities
|
|||
|
||||
Self update.
|
||||
|
||||
## ENVIRONMENT AND CONFIGURATION VARIABLES
|
||||
|
||||
`git config --add git-extras.default-branch $BRANCH`
|
||||
|
||||
Change the default branch to `$BRANCH` (defaut to `master`).
|
||||
|
||||
## COMMANDS
|
||||
|
||||
- **git-alias(1)** Define, search and show aliases
|
||||
|
|
|
|||
Loading…
Reference in a new issue