Menu

git rebase -i is not that scary — akrm al-hakimi

Hacker News·3 months ago
#8wGntEcP
#cachebag#commit#rebase#pick#commits
Reading 0:00
15s threshold

one of the most shocking things i’ve encountered in my early career as a junior dev is the fear surrounding git rebase -i .

even amongst some of my co-workers, who are in many ways, magnitudes smarter than i am, it seems to be a pattern in a lot of devs to be afraid of this command.

what it actually does

when you run:

git rebase -i HEAD~4

git does something delightfully mundane: it opens a text file. if you are working out of the terminal and haven’t fiddled around with your git settings, git config --global core.editor "_YOUR-EDITOR_" is a good way to allay your fears of conquering vim.

pick a1b2c3d Add user model pick e4f5g6h Fix typo in user model pick i7j8k9l Add login endpoint pick m0n1o2p WIP debugging login # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash" but discard this commit's message # d, drop <commit> = remove commit

a worthy thing…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.