Github: Mirroring gh-pages to master

后端 未结 8 2088
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 09:27

I\'m developing a jQuery plugin that\'s being hosting on GitHub. It has a demo included of which I\'m manually copying and pushing to the branch gh-pages, what

8条回答
  •  不思量自难忘°
    2020-12-12 10:01

    Do not do what denbuzze suggests above!! The + (plus sign) in the push makes it quietly accept non-fastforward updates. I found out the hard way that this can irrevocably cause work to be lost by leading to dangling commits. Simply removing the plus signs makes this a safer approach.

    push = refs/heads/master:refs/heads/gh-pages
    push = refs/heads/master:refs/heads/master
    

    now instead of causing a force update this will cause a warning & pull suggestion

    To https://github.com/someuser/repo.git
     ! [rejected]        master -> gh-pages (fetch first)
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/someuser/repo.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

提交回复
热议问题