简体   繁体   中英

git - how to replace Master?


I have a remote repo where my project is out of date.
I made new one local repo with new project, switched to new branch and made what I wanted. Now I want to push it (not changes - whole project) to that remote repo. How should I do that?

The -f argument to git push is probably what you want, it allows the receiving repo to be overwritten with unrelated changes. The older changes in the remote repo will still exist for a time but eventually be garbage collected.

When using git push you can specify which branch to push from and which branch to push to:

git push origin localbranch:remotebranch

This could fail if the remotebranch is not an ancestor of the localbranch . If you use -f you can force an overwrite, but be careful, because this will lose commits.

But you probably want to just merge the two locally, and push this updated master.

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