Or alternative title - How I learned to love Git rebase
When I first started working with Git, I was indoctrinated into the school of me...
For further actions, you may consider blocking this person and/or reporting abuse
Your alternative title is better. You should never rebase after you push to a remote. Ever.
I would clarify that as never rebase after you push to a remote shared with others. I push and rebase my feature branch all the time. It's especially helpful when reviewing pull requests.
A feature branch pushed up to a shared repository is available to others, so at this point, it becomes a matter of communication and etiquette. I wouldn't force push to a remote branch if someone else is actively committing or has an upstream based off of mine, but that situation is rare on the teams I work on.
If we end up with a feature branch that other developers would work on (pretty rare), we would just treat it like we do for master. Create a new branch off it, rebase and merge. Same workflow.
While it may be rare, I prefer a workflow that doesn't have any gotchas. If we never rebase anything that has been pushed, our workflow never requires the developer to wonder if anyone else might be affected by a rebase. My devs have enough to think about. The more I can take off their plate, the better.
That's the nice thing about git. It supports different workflows. So whatever works best for your team is what you should do. There is no right or wrong way.
As someone who makes many typos for a living, these are great!!
Really great of fixing multiple mistakes along the history.
One question, if it's just the latest commit you need to fix why not use
git commit --amend
?I often like to fixup and then keep going with my work. Then I'll rebase when I feel that I'm at a natural stopping point. But
git commit --amend
is an option!😳 That’s a lotta work to fix a sepling error! Good for you, though. This level of attention to detail implies that you are a polished developer.
Thanks! It's not only typos. Sometimes I may commit a "WIP", but fixup or squash the commit ass I get closer to opening a pull request. Getting comfortable with this technique has taught me the value of presenting polished work, to borrow your description. :)