How do I force a subtree push to overwrite remote changes?

后端 未结 4 1203
夕颜
夕颜 2021-01-31 08:03

We use a subtree deployment a lá this Gist to deploy a subdirectory of our Yeoman project. In our case, the branch is called production, not gh-pages.

4条回答
  •  忘掉有多难
    2021-01-31 08:50

    The trick was to chain the subtree split into a forced push:

    git push origin `git subtree split --prefix dist master`:production --force
    

    I got this from the Addendum of http://clontz.org/blog/2014/05/08/git-subtree-push-for-deployment/, who actually references this answer on Stack Overflow. I had skimmed this one earlier but Steve Clontz's post made it click for me.

提交回复
热议问题