Last active
November 7, 2019 19:24
-
-
Save sryabkov/f7fd0bfc3157675b846ba832cc504084 to your computer and use it in GitHub Desktop.
Git shortcuts (for .bash_profile or .bashrc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Sergei Ryabkov | |
email = [email protected] | |
[diff] | |
tool = bcomp | |
[difftool] | |
prompt = false | |
[difftool "bcomp"] | |
trustExitCode = true | |
cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE" | |
[merge] | |
tool = bcomp | |
[mergetool] | |
prompt = false | |
[mergetool "bcomp"] | |
trustExitCode = true | |
cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE" "$BASE" "$MERGED" | |
[core] | |
excludesfile = /Users/sryabkov/.gitignore_global | |
[commit] | |
template = /Users/sryabkov/.stCommitMsg | |
[credential] | |
helper = osxkeychain | |
[alias] | |
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
b = branch | |
co = checkout | |
dd = difftool -d | |
s = status -s | |
rhh = reset --hard HEAD | |
rpo = remote prune origin | |
[diff "sopsdiffer"] | |
textconv = sops -d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show local orphaned branches - show local branches that track remote branches that have been deleted | |
alias glob="git branch -vv | grep ': gone]' | awk '{print \$1}'" | |
# show the root of the git repo | |
alias grr="git rev-parse --show-toplevel" | |
# show age of local git branches and description, if exists | |
git-branch-age-with-description() { | |
readarray -t branches < <(git branch | tr '*' ' ') | |
for branch in ${branches[@]}; do echo -e $(git show --format="%ci %cr" $branch | head -n 1) \\t $branch \\t \\t \\t \\t $(git config branch.${branch}.description); done | sort -r | |
} | |
alias gba="git-branch-age-with-description" | |
# show branch description for the current branch | |
git-branch-description-single-branch() { | |
branch=$(git branch --show-current) | |
branch_description=$(git config branch.${branch}.description) | |
branch_description=${branch_description:-"(no description)"} | |
echo -e "${branch}: ${branch_description}" | |
} | |
alias gbd="git-branch-description-single-branch" | |
# show branch descriptions for all local branches | |
git-branch-description-all-local-branches() { | |
readarray -t branches < <(git branch | tr '*' ' ') | |
for branch in ${branches[@]}; do echo -e ${branch}: $(git config branch.${branch}.description); done | |
} | |
alias gb="git-branch-description-all-local-branches" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment