简体   繁体   中英

How do I force the overwriting of a git branch I pushed and rebased?

Using Git, I was working on a feature branch. I pushed the branch to github so someone could look at it. Then, it had been a while, so I rebased it. How do I push my rebased branch over the old one? What pitfalls must I avoid? I think it's just git push --force (or --mirror ?), but I'm never sure.

Some relevant links:

You want to use git push --force but please remember that you are rewriting public history.

Rewriting public history is a very bad idea. Anyone else who may have pulled the old history will have to git pull --rebase and even worse things if they have tagged or branched from the rewritten history, so you must publish your humiliation so they know what to do.

The server may not allow this (but will on github). See receive.denyNonFastForwards (git-config)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM