3 ms·
All I know is that I "git push --force" all the time, and it has never caused anyone tracking my repositories to complain or stop sending me patches. I assume
by jrockway 17y ago
All I know is that I "git push --force" all the time, and it has never caused anyone tracking my repositories to complain or stop sending me patches. I assume this means git handles it fine. (I just tested this, and git does handle it fine. It says "forced update", and everything works normally. The reflog stores the old pre-force-push tree still, so you are free to revert and push -f the "old" tree, if you really feel the need to.)
Anyway, "git push --force" has the potential to lose data, but less potential than "rm -rf .". You will destroy your central repository, not anyone's actual work. ("Destroy your central repository" sounds bad, but isn't. The important copy is the one on your disk.)
A clean history is better than never using "push -f" IMHO. The manual authors apparently disagree.
- pyre 17y ago> The manual authors apparently disagree. Pushing doesn't always mean to a central repository. Since there is no distinction, you could be git pushing while on a branch that is tracking a topic branch in someone else's local (local to them) repo.
- jrockway 17y agoPushing to non-bare repositories is always considered harmful.