Git - simplest way to sync a repository with a checked out branch

前端 未结 2 1454
清酒与你
清酒与你 2021-01-14 14:15

My workflow is basically:

  • Create a repo on my desktop PC
  • Do some work on it and commit changes
  • Clone onto my laptop
  • Work on that, co
2条回答
  •  深忆病人
    2021-01-14 15:04

    You can set receive.denyCurrentBranch to warn to allow pushing to your desktop PC. However, this is dangerous. If there are some commits in your desktop PC, this push will cause confuse.

    The following is manual of receive.denyCurrentBranch for your reference.

      receive.denyCurrentBranch
          If set to true or "refuse", receive-pack will deny a ref update to
          the currently checked out branch of a non-bare repository. Such a
          push is potentially dangerous because it brings the HEAD out of
          sync with the index and working tree. If set to "warn", print a
          warning of such a push to stderr, but allow the push to proceed. If
          set to false or "ignore", allow such pushes with no message.
          Defaults to "refuse".
    

提交回复
热议问题