Reputation: 439
I have to rebase and then, squash and merge my changes. But, the rebasing is taking too much time and effort. So, what if, instead of rebasing, I delete the feature branch, create a fresh one from master and then, apply my changes at the top and push in a single commit?
Upvotes: 2
Views: 372
Reputation: 48729
From a technical standpoint, the end result is the same. Rebase is just a smart tool to do exactly what you describe.
I've resorted to manual editing a few times in the past, but generally it pays off to get proficient at using interactive rebase using Vim or Emacs.
rebase -i
seems arcane at first, especially as the default text editor is often Vim; however, the two go very well together: if you want to reorder commits, you just hit j
until you get to the commit you want to move dd
to delete the line then j
again (or k
to go up) until you find the place you want to put it, then p
to paste it.
Or, say you want to squash a three commits into one, use jjj
(or 3j
) to get to the line you want, then use cw
(change word) s
("squash" (see instructions at top of text file)) Esc
j
.
Where Esc leaves insert mode and returns to "normal" mode and .
repeats the last command.
Upvotes: 1