How do I properly force a Git push?

前端 未结 8 2210
一生所求
一生所求 2020-11-22 14:25

I\'ve set up a remote non-bare \"main\" repo and cloned it to my computer. I made some local changes, updated my local repository, and pushed the changes back to my remote r

8条回答
  •  耶瑟儿~
    2020-11-22 15:16

    First of all, I would not make any changes directly in the "main" repo. If you really want to have a "main" repo, then you should only push to it, never change it directly.

    Regarding the error you are getting, have you tried git pull from your local repo, and then git push to the main repo? What you are currently doing (if I understood it well) is forcing the push and then losing your changes in the "main" repo. You should merge the changes locally first.

提交回复
热议问题