Working locally with Git when main repository is SVN

前端 未结 4 1975
南旧
南旧 2021-02-02 01:41

There is an open source project I want to checkout and contribute to. The main repository is SVN but I want to work in Git. Is this possible?

Most of my searches turns u

4条回答
  •  死守一世寂寞
    2021-02-02 02:06

    Keeping a Git repository in sync with a Subversion repository is really easy:

    Clone the Subversion repository (in this simple example I am ignoring branches/tags)

    $ git svn clone https://url/to/repo/trunk
    

    Keep up-to-date with the Subversion trunk:

    $ git svn rebase
    

    Now, if you had commit access to the Subversion repo, you could push your changes:

    $ git commit
    $ git svn dcommit
    

    Otherwise, submitting a patch is your only option, if the committers to the Subversion repository have no interest in using Git:

    $ git diff 1cc92b96 > my_patch.patch
    

    In this case it's obviously best not to make commits to the branch you are syncing with the Subversion repo.

提交回复
热议问题