DEV Community

Discussion on: How to Undo Pushed Commits with Git

Collapse
 
po0q profile image
pO0q 🦄

Thanks for the revert approach instead of the hazardous force push 🙏🏻 some people might use to "cover" their mistakes. It often creates more problem than it solves, while revert is perfectly readable and safe.

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett

yeah thank you and I agree. Sometimes there's situations where a force push or "cover up" is needed..maybe for something like environment variables, but I agree that this method is easy to follow.

Collapse
 
po0q profile image
pO0q 🦄

@blackgirlbytes the problem is who's using it. Every time someone tries to manipulate the history and overwrite stuff, it's a bit risky, by nature. Even if git experts might have appropriate usages of the command, I prefer disabling it as a general rule (e.g., in GitHub, you can protect branches against force push).

If you work alone, you do what you want, including rewriting history, but at your own risks if you damage your repository. If you work in a team, that's not acceptable because you might mess with other's work.

Thread Thread
 
blackgirlbytes profile image
Rizèl Scarlett

You’re absolutely right

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
Sloan, the sloth mascot
Comment deleted
 
Sloan, the sloth mascot
Comment deleted
 
Sloan, the sloth mascot
Comment deleted
 
blackgirlbytes profile image
Rizèl Scarlett • Edited

Hey @nenadj ! Happy to have your thoughts here, but I prefer a more positive, kind conversation. I’m not a fan of being dismissive.

Comments like, “Learn everything about git and you won’t have a problem” isn’t helpful to anyone lol. I work at GitHub, and I don’t know everything about Git.

Here are some thoughts on why rewriting history may be dangerous: stackoverflow.com/questions/149100...

Thread Thread
 
nenadj profile image
Nenad

:D

Thread Thread
 
blackgirlbytes profile image
Rizèl Scarlett

Thank you so much :)