dotfiles
dotfiles copied to clipboard
Git scripts
most recent git branches
git for-each-ref \
--sort=committerdate refs/heads/ \
--format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
"stat" since "time"
git diff $(git rev-list -n1 --before="2 months ago" main) --shortstat
automated git rebase (needs testing)
#!/bin/bash
set -e
Color_Off='\033[0m'
Yellow='\033[0;33m'
target=${1:-master}
branch=$(git describe --contains --all HEAD)
if [[ "$target" == *"$branch"* ]]; then
echo -e "${Yellow}Your current branch is the target branch. Aborting.${Color_Off}"
exit 1;
fi
echo ""
echo -e "${Yellow}Rebasing $branch on top of $target${Color_Off}"
echo ""
echo -e "${Yellow}Updating Origin...${Color_Off}"
git fetch origin
echo -e "${Yellow}Updating $target Branch...${Color_Off}"
git checkout $target
git reset origin/$target --hard
echo -e "${Yellow}Rebasing...${Color_Off}"
git checkout $branch
git rebase $target