-
Notifications
You must be signed in to change notification settings - Fork 0
/
.dot_git
35 lines (29 loc) · 916 Bytes
/
.dot_git
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
#!/bin/bash
# Git alias for convenience
alias g='git'
# Enable tab completion for `g` as an alias for `git`
if type __git_complete &> /dev/null; then
__git_complete g __git_main
fi
# Additional Git aliases
alias gs='git status' # Shortcut for 'git status'
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' # Alias for managing dotfiles with Git
alias cs='config status' # Shortcut for checking status of dotfiles
# Enable git branch name completion if the completion script is present
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Use Git’s colored diff when available
if hash git &>/dev/null; then
diff() {
git diff --no-index --color-words "$@"
}
fi
# Function to create short URLs using git.io
gitio() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo "Usage: \`gitio slug url\`"
return 1
fi
curl -i https://git.io/ -F "url=${2}" -F "code=${1}"
}