git merging branches in a bare repository

前端 未结 3 1497
花落未央
花落未央 2021-02-19 13:53

I would like to create the following setup for my git repos:

I currently have a local git repo with all my working files. I would like to be able to setup a central bar

相关标签:
3条回答
  • 2021-02-19 14:08

    git checkout checks out a branch into the working tree – how do you think this should have worked without a working tree? And git merge and most other commands don’t work, because there is no HEAD inside of a bare repository.

    To answer your question: You don’t work within the bare repository. A bare repository is only there to keep the data; if you want to work with it, use a clone which is not bare.

    So from any other repository, you pull from the bare repository, merge locally and push your changes back to it. You should do this from your development repository btw. so that the live and test repositories only pull from their branch.

    0 讨论(0)
  • 2021-02-19 14:14

    Note, this can actually be done on a bare repo, but you have to work around the normal interface.

    $ git read-tree -i -m branch1 branch2
    $ COMMIT=$(git commit-tree $(git write-tree) -p branch1 -p branch2 < commit message)
    $ git update-ref mergedbranch $COMMIT
    
    0 讨论(0)
  • 2021-02-19 14:17

    You must first clone from bare repository, merge your branch, then push to bare repository again. Because you haven't any working tree on bare repositories for solve conflict.

    0 讨论(0)
提交回复
热议问题