File: SetupGitAliases.sh

package info (click to toggle)
insighttoolkit4 4.13.3withdata-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 489,260 kB
  • sloc: cpp: 557,342; ansic: 146,850; fortran: 34,788; python: 16,572; sh: 2,187; lisp: 2,070; tcl: 993; java: 362; perl: 200; makefile: 129; csh: 81; pascal: 69; xml: 19; ruby: 10
file content (46 lines) | stat: -rwxr-xr-x 1,835 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash

# Set up some useful git aliases, global aliases for general things
echo -n "Would you like general Git aliases to be global? [y/N]:"
read answer

if [ "$answer" == "y" ]; then
  global="--global"
elif [ "$answer" == "yes" ]; then
  global="--global"
elif [ "$answer" == "Yes" ]; then
  global="--global"
else
  global=""
fi

GIT=git

GITCONFIG="${GIT} config ${global}"

# General aliases that could be global

# Pull all updates - first a general pull and then submodules.
${GITCONFIG} alias.pullall "!bash -c \"git pull && git submodule update --init\""
# Useful alias to see what commits are on the current branch with respect
# to origin/master.
${GITCONFIG} alias.prepush 'log --graph --stat origin/master..'

# Staging aliases - can help streamline staging topic branches.
GITCONFIG="${GIT} config"
stage_cmd='ssh git@itk.org stage ITK'
git_branch="\$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')"
# General alias to run the SSH command, e.g. git stage-cmd print.
${GITCONFIG} alias.stage-cmd "!${stage_cmd}"
# Push the current topic branch to the stage.
${GITCONFIG} alias.stage-push "!bash -c \"git fetch stage --prune && git push stage HEAD\""
# List all staged topic branches.
${GITCONFIG} alias.stage-branch "!bash -c \"${stage_cmd} print\""
# Merge the current topic branch (if staged) into the next branch.
${GITCONFIG} alias.stage-merge-next "!bash -c \"${stage_cmd} merge -b next ${git_branch}\""
# Merge the current topic branch (if staged) into the master branch.
${GITCONFIG} alias.stage-merge "!bash -c \"${stage_cmd} merge ${git_branch}\""
# Alias to push the current topic branch to Gerrit
${GITCONFIG} alias.gerrit-push "!bash Utilities/Git/git-gerrit-push"
# Alias to push and merge the active topic to the stage
${GITCONFIG} alias.gerrit-merge "!bash Utilities/Git/git-gerrit-merge"