简体   繁体   中英

overwrite github repo by local files

I currently have a project which I took over from another person. After writing for a couple month, I realized that I might need to push to the github repo. However, when I pulled, there were a lot of merge conflicts. I currently only want keep what I am having on my local machine. I tried to use git pull -X ours but it still keeps the code from the remote repo.

Is it possible to keep all my local files as they are and overwrite what's on the github repo?

If you really do not care about loosing the commits on the remote that conflict with yours, you can force push what you have on your local machine to the remote with:

git push -f

The commits on the remote that you do not have locally (for the branch you are pushing from) will get lost and your local commits will be pushed, effectively making the remote branch match your local branch.

If you don't want to loose the divergent commits on GitHub, you can create a new branch.

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