3 ms·
I am using zsh/iterm on my mac so here are mine: # branches that were touched lately nb() { git for-each-ref --sort=-committerdate refs/heads/ -
by vittore 8y ago
I am using zsh/iterm on my mac so here are mine:
# branches that were touched lately
nb() {
git for-each-ref --sort=-committerdate refs/heads/ -- format='%(committerdate:short) %(authorname) %(refname:short)' | head -n 10
}
# squash!
squash() {
if [ -n "$1" ]; then
git reset --soft HEAD~$1 && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
fi
}
# open pr page on github for current branch
pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open "https://github.com/$repo/pull/new/$branch?expand=1"
}
# check who uses port
port() {
lsof -i tcp:"$@"
}
# rebases local branch from origin /master and force pushes it
repush(){
git fetch origin master
git stash
git rebase origin/master
git push --force
git stash pop
}