Nice! Sometimes, I find myself taking that approach as well. I used the one in my article because it's safe and hopefully easy for folks to understand.
Although git is a distributed VCS and the client repositories are more or less independent, it is most common that the one remote repository is treated as the single source of truth.
Force pushing to that remote repo is essentially like saying 'screw what others might have pushed before, my local copy is the new single source of truth now'
I generally do this
If you're working with others, I'd recommend
git push --force-with-lease
to avoid accidentally deleting someones changes.It is considered good practice to disable force pushing. Often it's just banned.
It's considered good practice to have readable commit logs, and force pushing is essential for that task.
Nice! Sometimes, I find myself taking that approach as well. I used the one in my article because it's safe and hopefully easy for folks to understand.
Me too. However this article is a new learning..
You shoud never force
Why not? The option is there.
Here’s an article on why it’s sometimes dangerous : blog.developer.atlassian.com/force...
Thanks, I'll have a look. But I reacted more to the "never".
Gotcha..I agree..never is a little strong lol. There's exceptions.
Although git is a distributed VCS and the client repositories are more or less independent, it is most common that the one remote repository is treated as the single source of truth.
Force pushing to that remote repo is essentially like saying 'screw what others might have pushed before, my local copy is the new single source of truth now'
The king is dead, long live the king!
You explained that pretty well! Going to refer to your response every time someone questions why I’m not using git push force