How do I properly force a Git push?

前端 未结 8 2212
一生所求
一生所求 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:11

    I would really recommend to:

    • push only to the main repo

    • make sure that main repo is a bare repo, in order to never have any problem with the main repo working tree being not in sync with its .git base. See "How to push a local git repository to another computer?"

    • If you do have to make modification in the main (bare) repo, clone it (on the main server), do your modification and push back to it

    In other words, keep a bare repo accessible both from the main server and the local computer, in order to have a single upstream repo from/to which to pull/pull.

提交回复
热议问题