Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
executable file 18 lines (12 sloc) 325 Bytes
#!/usr/bin/env bash
# git-move-commits: move the last N commits on the current branch to another branch
set -eo pipefail
usage() {
echo "usage: git move-commits <branch> [# of commits]"
exit
}
[[ -z "${1}" ]] && usage
ncommits="${2:-1}"
git branch "${1}"
git reset --hard HEAD~"${ncommits}"
git checkout "${1}"
You can’t perform that action at this time.