summaryrefslogtreecommitdiff
path: root/dotfiles/system/.profile.d/git.sh
blob: c637e989f08901e99676d7da7ada39896113ed2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Craig Jennings <c@cjennings.net>
# git settings and convenience aliases, sourced by .profile

alias gitlog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias gitstatus='git status -sb '
alias gitcom='git commit -m '
alias gitpp='git pull --prune '                    # clean up any orphaned git objects
alias gittagbydate="git for-each-ref --sort=creatordate --format '%(refname) %(creatordate)' refs/tags"

gitsp() {
	git stash && git pull && git stash pop
}

gitck() {
	git checkout "$(git branch --all | fzf | tr -d '[:space:]')"
}

gitdiff() {
	preview="git diff $@ --color=always -- {-1}"
	git diff "$@" --name-only | fzf -m --ansi --preview "$preview"
}