I made a git mirror of a svn repository using
git svn clone svn://svn.svnrepo.com
I uploaded it to github and was able to update the local repo using
git svn rebase svn://svn.svnrepo.com
and push the updates to github
Later after I had deleted the local copy I wanted to update the remote again
So I cloned the git repo
git clone git://git.gitrepo.com
But when I tried to rebase I got an error
git svn rebase svn://svn.svnrepo.com
Data from a previous version of git-svn exists, but
(required for this version (1.8.3.2) of git-svn) does not exist.
Done migrating from a git-svn v1 layout
then it gives an Unable to determine upstream SVN information from HEAD history error
Ive tried:
git svn init svn://svn.svnrepo.com
with:
git svn fetch
but that starts a re-download of the entire svn repo which takes over 24 hours The current svn revision is marked by the git-svn-id in the commit log and seems fine, how do I stop git svn fetch from re-fetching files that already exist or rebase it without an entire re-download? This mirror never had commits that would make it different from the svn upstream.
Prepare a migration environment. Convert the source SVN repository to a local Git repository. (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN. Push the local Git repository to a remote Git repository hosted on Azure Repos.
git works perfectly fine with a svn repository on the other side, why not benefit from that? Certainly possible, and a fair move towards your colleagues, not to push unfinished changes. however there is one huge danger hidden in there: you will tend to make very few commits to the companies repository.
Getting the latest changes from SVN The equivalent to git pull is the command git svn rebase . This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch.
# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...
just need to run the following commands
git config svn-remote.svn.url $SVN_URL
git config svn-remote.svn.fetch :refs/remotes/git-svn
svn2git --rebase
or you can also manually edit .git/config
to add the svn-remote
section:
[svn-remote "svn"]
url = SVN_URL
fetch = :refs/remotes/git-svn
and from now on just svn2git --rebase
--
PS: credit to my sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With