Cherry-pick the reflog autocompleted
I don’t remember how often I have to do a single commit on a branch, only to find that when I push the branch I find someone else (maybe even me?) have pushed another commit to that branch. And wanting to keep the history clean and only do fast forward pulls (no merge-commits or anything here) I find it easiest to just do a
git reset HEAD~1 --hard
before pulling (again) from the remote repository.
But then I always need to quickly cherry-pick the already committed code… and I really hate when I need to do some weird song and dance to get the commit id (which I off course have either never even looked at or at least forgotten).
Well bottom line is; I now have an alias that runs:
git cherry-pick $(git reflog |fzf |cut -d' ' -f1)
Which allows me to quickly search for the commit I want to cherry-pick and have it cherry-picked…. of course the alias is aptly named: cpr.