How to convert a normal Git repository to a bare one?

后端 未结 17 1000
礼貌的吻别
礼貌的吻别 2020-11-22 08:05

How can I convert a \'normal\' Git repository to a bare one?

The main difference seems to be:

  • in the normal Git repository, you have a .git

17条回答
  •  逝去的感伤
    2020-11-22 08:32

    In case you have a repository with few local checkedout branches /refs/heads/* and few remote branch branches remotes/origin/* AND if you want to convert this into a BARE repository with all branches in /refs/heads/*

    you can do the following to save the history.

    1. create a bare repository
    2. cd into the local repository which has local checkedout branches and remote branches
    3. git push /path/to/bare/repo +refs/remotes/origin/:refs/heads/

提交回复
热议问题