From chriskirknielsen's tweet archive

I aliased a git command to move commits from one branch to another (usually main to dev). A bad idea? 🤷

.gitconfig
[alias]
switcheroo = "!f(){ git checkout ${3}; git cherry-pick ${1}; git checkout ${2}; git reset --hard HEAD~1; }; f"

Usage: git switcheroo {COMMIT HASH} {SOURCE BRANCH} {TARGET BRANCH}
➡️ e.g: git switcheroo 7edaf7 main dev