Hacker News new | ask | show | jobs
by shoo 788 days ago
rebase is git's swiss army chainsaw.

i use rebase frequently, but i never remember which direction the operation goes in. do you need to checkout the source branch or target branch? truly, it is unknowable. my workflow is to type `man git rebase` and hit space to page through the manual until the first ascii tree surgery diagram appears. then i stare at it until i remember that i need to have checked out my feature branch and am meant to type `git rebase main`. i have trained myself to read the man page every time, perform the operation correctly, then immediately forget.

https://git-scm.com/docs/git-rebase

2 comments

That's why I always use git cherry-pick for specific commits that I want.

It's essentially a "cp thing-i-want ."

Combined with git reflog your repo becomes as understandable as a floppy disk.

I use "branch.autosetuprebase=local" and/or --set-upstream-to ; then I can just type "git rebase" while on the thing I want rebased and not have to think about it. (Useful in the gerrit workflow which kind of forces you to have stacks of rebased changes)