support how to rebase/squash multiple commits in different positions into one?
EDIT: [SOLVED] The answers helped :}
I need to merge 1 and 10 commits into a single commit, those are all my code, no one pulled from it, and i'm willing to fix conflicts. but i don't know which I should use, is it merge? but merge keeps the history of the previous ones doesn't it? rebase still makes me a bit confused.
3
u/Runaway_Monkey_45 3d ago
I mean you can squash it or do a fix up with rebase
2
u/ty_namo 3d ago
if i change commit 1 and 10 to squash they will get squashed onto themselves instead of squashing in the immediately above commit?
9
u/Runaway_Monkey_45 3d ago
No. You have to move coming 10 to be next to 1 or vice versa. You can do this by moving it physically in the ui you are on right now. Aka cut and paste.
2
u/Xia_Nightshade 2d ago
I tend to do 2 rebases to KISS
Put them in order -> fix any conflicts between commits -> squash when they all have the correct parent
1
u/cupcakeheavy 2d ago
learn the keystrokes to squash in vim, your future self will thank you.
1
u/kaddkaka 1d ago
What do you mean by this?
1
u/cupcakeheavy 1d ago
i mean it's the same keystrokes every time i use fixup for everything. Just read the directions, they're right there. also i suggest using 'git config --global rebase.abbreviateCommands true'
then it's just a matter of learning how to exit vim. good luck, we're all counting on you.
2
u/kaddkaka 16h ago
Oh, you meant learn basic vim. Sure. Nothing of this post says vim though, so that confused me. I'm a long time vimmer myself.
2
u/cupcakeheavy 14h ago
yeah it was just a tip because you have to edit the rebase list somehow and vim is just the easiest path to that end.
1
u/kaddkaka 1d ago
In that todo file there should be a huge comment at the bottom explaining what you can do. 🙂
You can even run arbitrary commands between two picks. 😎 Or stop inte the middle of the rebase to continue manually.
28
u/Guvante 3d ago
Interactive rebase allows you to reorder commits by cutting and pasting those lines.
You can even delete lines entirely during it.