Sometimes its nice to clean up commits before merging them into your main code repo; in this lesson, we go over using
git rebase to
squash commits together and then rename the condensed commit message. We also talk about potential issues with rebasing and where to be careful.
Does git push --force-with-lease will do a better job?
@omar, thanks for the comment. I didn't include it
--force-with-lease in this course for two reasons 1) it is only available in later versions of git that not everyone has and 2) in my opinion, you should never use
--force except on your own branch that only you are working on, so
---force-with-lease have the same result (since there is nobody else's work that you could possibly override). So, in my mind,
---force-with-lease should never be needed because you shouldn't force a push if it is going to a place where someone else is contributing as well - where history could be damaged. But that's my 2 cents :)