-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_bash_git
More file actions
43 lines (37 loc) · 1.74 KB
/
dot_bash_git
File metadata and controls
43 lines (37 loc) · 1.74 KB
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
# Git helpers
source ~/bin/git-branch.bash
source ~/bin/git-completion.bash
source ~/bin/git-repull-ship.bash
# Load the global .gitignore file - only if not already set
if [ -f ~/.gitignore ] && ! git config --global --get core.excludesfile >/dev/null 2>&1
then
git config --global core.excludesfile $HOME/.gitignore
fi
# Use hub as a git wrapper to make git more github-aware
if [ ! -z "`which hub`" ] && [ -x "`which hub`" ]
then
alias git=hub
fi
# Alias git to g and autocomplete for g as well
alias g=git
complete -o default -o nospace -F _git g
# Aliases for configuring work/personal repos
alias gitme="git config user.email david@cloudartisan.com; git config user.name cloudartisan"
alias gitsfdc="git config user.email d.l.taylor@salesforce.com; git config user.name d-l-taylor; git config user.signingkey 449F9A0AFAC505592FEFB7EA8F53FA22DC77696C; git config commit.gpgsign true; git config push.gpgsign if-asked; git config gpg.program $(which gpg)"
alias gitsoma="git config user.email d.l.taylor@salesforce.com; git config user.name d-l-taylor; git config user.signingkey 449F9A0AFAC505592FEFB7EA8F53FA22DC77696C; git config commit.gpgsign true; git config push.gpgsign if-asked; git config gpg.program $(which gpg)"
# Set git identity for any directory under git/{cloudartisan,salesforce}
function set_git_identity_based_on_directory() {
# Only if we're in a git working directory
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
case "$PWD" in
*git/cloudartisan/*)
gitme
;;
*git/salesforce/*)
gitsoma
;;
esac
fi
}
# Add the function to be called every time the prompt is shown (which happens after every command)
PROMPT_COMMAND="set_git_identity_based_on_directory;${PROMPT_COMMAND}"