DEV Community

Discussion on: What is git rebase?

Collapse
 
mxdanielon profile image
Daniel Gallegos

Great post to exemplify rebase! Just remember that for pushing changes to remote it could be better to git push --force-with-lease instead of the typical git push --force. The former would watch for any changes you don't have in your local branch.

Collapse
 
borrrden profile image
Jim Borden

As the other Daniel pointed out never force push to the master branch and always let relevant people know when you do for another. What do do with your rebased changes (in terms of pushing) probably deserves a separate post all together but the main goal here is to not have to force push at all. In the example I've given no force push is needed for the main branch (only the dev branch if it is going to continue)

Collapse
 
jastbytes profile image
Jan Steffen • Edited

May the --force be with you! Seriously, never force push to the master. It's not like you have to with rebase. Don't understand the advice though.

forcepush

Collapse
 
dhiller profile image
Daniel Hiller

If you force push to a main branch everyone will hate you. I don't think you should give this advice in a posting for git beginners. Just because you can do that doesn't mean it's the right thing to do....