/
g2-install.sh
executable file
·62 lines (49 loc) · 2.67 KB
/
g2-install.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#
# Call this program to install G2
[ `basename $BASH` != "bash" ] && echo "G2 only supports bash at the moment, thank you for trying." && exit 1
# Figure the script HOME PATH
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
OLDpwd=$PWD
cd $DIR
export G2_HOME=$DIR
export GIT_PS1_DESCRIBE_STYLE=branch
source ./cmds/color.sh
tips=(
"${boldon}g sync${boldoff} adds your changes to the tip of the branch and synchronizes with the servers both ways."
"${boldon}g freeze${boldoff} is a handy command to freeze all the changes in one shot."
"${boldon}g2${boldoff} saves time by providing high level commands."
"${boldon}g2${boldoff} is safer than git as it prompts before destructive actions."
"run ${boldon}g setup${boldoff} to configure git."
"${boldon}g2${boldoff} provides two letter acronyms for most commands."
"${boldon}g2${boldoff} eases the merge process by introducing ${boldon}g continue${boldoff} and ${boldon}g abort${boldoff}."
"${boldon}g2${boldoff} purposely provides a reduced set of commands."
"${boldon}g2${boldoff} enhances command line experience with auto-completion <TAB-key> and a smart prompt."
"${boldon}g2${boldoff} warns when the branch history was changed on the server (forced pushed)."
"${boldon}g2${boldoff} checks the branch freshness prior to merging and warns accordingly."
"${boldon}g2${boldoff} enforces a clean linear history by introducing new commands."
"${boldon}g2${boldoff} requires a clean state before rebasing, checking out, branching or merging."
"${boldon}g2${boldoff} provides guidance when it cannot perform an operation."
"${boldon}g2${boldoff} brings a number of friendly commands such as : ${boldon}panic, sync, freeze, wip${boldoff}."
"${boldon}g2${boldoff} eases branch creation. try it ${boldon}g br myBranchName${boldoff}."
"Need to display your ssh public key? try ${boldon}g key${boldoff}."
"${boldon}g2${boldoff} is just easier at undoing things: try ${boldon}g undo commit${boldoff} or ${boldon}g undo merge${boldoff}."
"When lost, ${boldon}g panic${boldoff} is the easiest way to get back on track."
"Use ${boldon}g track${boldoff} to review how local/remote branches are setup."
"Remember, you may always access the native git command using \"\$GIT_EXE\"."
"Unlike git, ${boldon}g2${boldoff} actions only apply to the current branch.");
echo -n -e "Installing ${boldon}G2${boldoff}.."
source ./g2-completion.sh
echo -n "."
source ./g2-config.sh
echo -n "."
source ./g2.sh
echo -n "."
source ./g2-prompt.sh
alias g=__g2_eval;
alias git=__g2_eval;
echo " Enjoy!"
echo -e "${boldon}Tip of the day${boldoff}: ${tips[RANDOM % ${#tips[@]}]} ${reset}"
cd $OLDpwd