'Easiest way to change from SVN working copy into Git working tree
We have 6 sites (one prod, 5 dev) and although they are used for different purposes, they are for the most part the same site, they all use code from the same URL in an SVN repository.
I have imported the SVN repository for the project, including the log, for the project into Git, following the advice here, using a git svn clone command that looks something like this:
git svn clone http://my-project.googlecode.com/svn/ \
--authors-file=users.txt --no-metadata --prefix "" -s my_project
Now I would like to make those SVN working copies into Git working trees. Meaning, I would like to be able to do Git pushes on the files to the new repository location in Git, but I would rather not move the files for the entire site. Also, there are some local changes in the development sites that I want to keep. I have not seen any good answers that tell how to do this.
For each site, I could do a git clone, copy the svn working copy over the git clone, then move the site code somewhere, and move the git clone with copied site code to where the code for the site was. This seems problematic. Is there any easier way?
Just noticed that the most upvoted answer (not the accepted one) here works. I left off the last command, as it overwrites local changes.
git init
git remote add origin PATH/TO/REPO
git fetch
Solution 1:[1]
The .git
directory contains a complete Git repository. Clone the repository, and copy its .git
directory into each working tree.
You can save a little time and space by doing a bare clone, git clone --bare
. This is the contents of the .git
directory with no working tree. You can clone that straight into a .git
directory in each working tree.
cd working_tree
git clone --bare <url> .git/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Schwern |