How to force push a reset to remote repository?

后端 未结 10 1828
生来不讨喜
生来不讨喜 2020-11-29 18:49

Our remote master branch somehow got messed up. Current development code is on the master branch along with the latest commits. Obviously, the development code is not ready

10条回答
  •  清酒与你
    2020-11-29 19:10

    I'm using this group of commands to reset my remote repo, this will re-initialize your local repo and relink with your remote repo then force push the updates.

    I think this way won't work in your case, but may be useful for someone else

    go to the source folder then run the commands : note that https://github.com/*.git is your remote repo link

    git init
    git remote add origin https://github.com/*.git
    git add .
    git commit -m "initial commit"
    git push origin master -f
    git push --set-upstream origin master
    

    **Note: this will clear all your git history on your master branch**

提交回复
热议问题