Nice, I find git really great! Other useful actions to use during git rebase -i are the fixup and reword (or just f and r, respectively).
Fixup is the same as squash, but it just keeps the message of the commit "receiving" the changes from the other commit. By doing this, it will not ask you for the final commit's message (what is going to be left after all the squashes).
Reword simply opens the editor so you can change the message (like it would happen with an ammend, but you can do it now, during the rebase).
When we simply squash, in fact, we have the opportunity to change the final commit's message during that screen where it shows all the messages from all the commits, like here
# This is a combination of 3 commits.
# This is the 1st commit message:
A simple commit message
# This is the commit message #2:
Another simple commit message
# This is the commit message #3:
Yet another simple commit message
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
Whatever you write at the spot of the 1st commit message will stay as the final commit's message. If you leave it blank, it will use the second if I'm not mistaken, but if you erase all of them, the rebase will fail (might have to double check).
I myself have always found using the squash to edit messages a little weird, and my rite when I want to squash things is to combine fixup with reword, like this:
$ git rebase -i 8aacce3^
reword 8aacce3 A simple commit message
fixup 41e00c3 Yet another simple commit message
fixup 09a149d Another simple commit message
There's also this guide (kind of like a game) to learn in a more visual way about git branches: learngitbranching.js.org/
Thank you for your comments and suggestion! The guide is very interesting and easy to undestand with the visual! I will try to use and see fixup next time😃 Obrigada!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice, I find git really great! Other useful actions to use during
git rebase -i
are thefixup
andreword
(or justf
andr
, respectively).Fixup is the same as squash, but it just keeps the message of the commit "receiving" the changes from the other commit. By doing this, it will not ask you for the final commit's message (what is going to be left after all the squashes).
Reword simply opens the editor so you can change the message (like it would happen with an ammend, but you can do it now, during the rebase).
When we simply
squash
, in fact, we have the opportunity to change the final commit's message during that screen where it shows all the messages from all the commits, like hereWhatever you write at the spot of the 1st commit message will stay as the final commit's message. If you leave it blank, it will use the second if I'm not mistaken, but if you erase all of them, the rebase will fail (might have to double check).
I myself have always found using the squash to edit messages a little weird, and my rite when I want to squash things is to combine
fixup
withreword
, like this:There's also this guide (kind of like a game) to learn in a more visual way about git branches:
learngitbranching.js.org/
Thank you for your comments and suggestion! The guide is very interesting and easy to undestand with the visual! I will try to use and see
fixup
next time😃 Obrigada!