Skip to content

Instantly share code, notes, and snippets.

View geebru's full-sized avatar

Greg Bruening geebru

View GitHub Profile
@geebru
geebru / delete-merged-branches.sh
Last active February 1, 2022 16:01
A shell script to check for all merged branches (local/remote) older than 6 months and delete them.
#!/bin/sh
for branch in $(git branch -r --merged | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'develop$\|develop-hybrid$\|master$\|IPM-\|4\.'); do
if [[ "$(git log $branch --since "4 months ago" | wc -l)" -eq 0 ]]; then
local_branch_name=$(echo "$branch" | sed 's/origin\///')
echo 'Deleting: ' $local_branch_name
#git push origin :$local_branch_name
fi
done
@geebru
geebru / bash-prompt.sh
Last active August 12, 2021 19:26
Bash prompt
if test -f ~/.config/git/git-prompt.sh
then
. ~/.config/git/git-prompt.sh
else
PS1='\[\033]0;$PWD\007\]' # set window title
PS1="$PS1"'\n' # new line
PS1="$PS1"'\[\033[32m\]' # change to green
PS1="$PS1"'\u ' # user@host<space>
PS1="$PS1"'\[\033[35m\]' # change to purple
PS1="$PS1"'\w' # current working directory
@geebru
geebru / .bashrc
Last active March 25, 2024 13:37
.bashrc Profile
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gac='git add --all && git commit -m'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply'