3
# Set up some useful git aliases, global aliases for general things
4
echo -n "Would you like general Git aliases to be global? [y/N]:"
7
if [ "$answer" == "y" ]; then
9
elif [ "$answer" == "yes" ]; then
11
elif [ "$answer" == "Yes" ]; then
19
GITCONFIG="${GIT} config ${global}"
21
# General aliases that could be global
23
# Pull all updates - first a general pull and then submodules.
24
${GITCONFIG} alias.pullall "!bash -c \"git pull && git submodule update --init\""
25
# Useful alias to see what commits are on the current branch with respect
27
${GITCONFIG} alias.prepush 'log --graph --stat origin/master..'
29
# Staging aliases - can help streamline staging topic branches.
30
GITCONFIG="${GIT} config"
31
stage_cmd='ssh git@itk.org stage SimpleITK'
32
git_branch="\$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')"
33
# General alias to run the SSH command, e.g. git stage-cmd merge -b master mytopic.
34
${GITCONFIG} alias.stage-cmd "!${stage_cmd}"
35
# Push the current topic branch to the stage.
36
${GITCONFIG} alias.stage-push "!bash -c \"git fetch stage --prune && git push stage HEAD\""
37
# List all staged topic branches.
38
${GITCONFIG} alias.stage-branch "!bash -c \"${stage_cmd} print\""
39
${GITCONFIG} alias.stage-print "!bash -c \"${stage_cmd} print\""
40
# Merge the current topic branch (if staged) into the next branch.
41
${GITCONFIG} alias.stage-merge "!bash -c \"${stage_cmd} merge -b next ${git_branch}\""
42
# Merge the current topic branch (if staged) into the master branch.
43
# this should be harder to do, and only done by a few, so no alias is provided
44
#${GITCONFIG} alias.stage-merge "!bash -c \"${stage_cmd} merge ${git_branch}\""
46
# Alias to push the current topic branch to Gerrit
47
${GITCONFIG} alias.gerrit-push "!bash -c \"git fetch gerrit && git push gerrit HEAD:refs/for/master/${git_branch}\""
48
# while we currently don't need a script, it may make a future need easier
49
${GITCONFIG} alias.gerrit-push "!bash Utilities/Git/git-gerrit-push"
b'\\ No newline at end of file'