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

后端 未结 4 1194
夕颜
夕颜 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:43

    There is actually a solution that is much more simple.

    Source: https://gist.github.com/cobyism/4730490#gistcomment-2337463

    Setup

    $ rm -rf dist
    $ echo "dist/" >> .gitignore
    $ git worktree add dist gh-pages
    

    Making changes

    $ make # or what ever you run to populate dist
    $ cd dist
    $ git add --all
    $ git commit -m "$(git log '--format=format:%H' master -1)"
    $ git push origin production --force
    $ cd ..
    

提交回复
热议问题