~ubuntu-branches/debian/sid/simpleitk/sid

« back to all changes in this revision

Viewing changes to Utilities/DevelopmentSetupScripts/SetupGitAliases.sh

  • Committer: Package Import Robot
  • Author(s): Ghislain Antony Vaillant
  • Date: 2017-11-02 08:49:18 UTC
  • Revision ID: package-import@ubuntu.com-20171102084918-7hs09ih668xq87ej
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
 
 
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]:"
 
5
read answer
 
6
 
 
7
if [ "$answer" == "y" ]; then
 
8
  global="--global"
 
9
elif [ "$answer" == "yes" ]; then
 
10
  global="--global"
 
11
elif [ "$answer" == "Yes" ]; then
 
12
  global="--global"
 
13
else
 
14
  global=""
 
15
fi
 
16
 
 
17
GIT=git
 
18
 
 
19
GITCONFIG="${GIT} config ${global}"
 
20
 
 
21
# General aliases that could be global
 
22
 
 
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
 
26
# to origin/master.
 
27
${GITCONFIG} alias.prepush 'log --graph --stat origin/master..'
 
28
 
 
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}\""
 
45
 
 
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'