How to commit a git repository inside another git repository

前端 未结 3 937
甜味超标
甜味超标 2021-01-17 16:32

I\'m developing an application that uses git, so I need to test its integration with git. Inside my git repository, I need to have another repository (my_git_repo/tests/anot

3条回答
  •  离开以前
    2021-01-17 16:47

    You could transform your nested repository into a bare repo. A bare repository can be committed inside another repository.

    One way (more here) to transform a repository into a bare repository:

    git clone --bare test-repo 
    cd test-repo.git # directory created by previous command
    git remote rm origin # to remove the pointer to your original repo
    

    Now, test-repo.git can be committed inside your main repository. If, at some point, you'd like to make edits in your test repository (edit files, add commits) you can just clone it back into a non-bare repo (git clone test-repo.git).

提交回复
热议问题