Also, just to add a tiny info, instead of going HEAD~n to get the n last commits, you could pick the hash of the commit you want to go to.
Let's imagine that I have these 4 commits:
abc123 Last commit I made
def456 Yet another message
ghi789 Another message
jkl012 A commit message
If I want to rebase the last 3 commits, I could pick the hash ghi789 and execute the rebase command like this:
git rebase -i ghi789^
We have to put the ^, otherwise git will pick all the commits but the one indicated by the hash.
Alternatively, you could pick the hash of the commit that came immediately before the one I want, in this case, jkl012, so this would also work:
git rebase -i jkl012
In the end it's all the same and we should do whatever we like and is used to, but I like knowing multiple ways of doing the same thing! 😅
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.
Also, just to add a tiny info, instead of going HEAD~n to get the n last commits, you could pick the hash of the commit you want to go to.
Let's imagine that I have these 4 commits:
If I want to rebase the last 3 commits, I could pick the hash
ghi789
and execute the rebase command like this:We have to put the
^
, otherwise git will pick all the commits but the one indicated by the hash.Alternatively, you could pick the hash of the commit that came immediately before the one I want, in this case,
jkl012
, so this would also work:In the end it's all the same and we should do whatever we like and is used to, but I like knowing multiple ways of doing the same thing! 😅