Local git repo creation
I have code base checked out from svn. (code_base
). I want to create a local git repo from this code base and then use git branches to play with it. So, I am expecting a structure like follows:
currently available code = c:/code_base
c:/repo_head
(Based on c:/code_base
)
git clients from n开发者_开发问答ewly repo = c:/repo_client1 c:/repo_client2
I am trying to create a bare repo (repo_head
) and then trying to add code_base
but it does not seem to work. I am getting lot of errors.
What is the best way to go about it?
The easiest way is probably to create the folder repo_head then run
git init repo_head
then copy all the contents from code_base into repo_head. Finally
git add --all
git commit -a
then you will have a new git repo to play with!
You could probably just initialize code_base as a git repo but I'm not sure how that interacts with the svn meta data . . .
I've had surprising success initing and running a git repo right IN a svn working directory. So, I check out from SVN to a directory, cd
into it, do git init
, and very first thing put the string ".svn" into .gitignore
.
The way I'm working, git's master branch is in sync with SVN (via manual ups and cis). My teammates are developing on the main SVN trunk, and I'm frequently pulling down their work to the SVN working directory and committing that to my local git master.
I have a git development branch for the feature I'm working on for a future release. I can check that out into the working directory, develop locally, merge newly-pulled SVN stuff from my git master branch, etc. If I have any hotfix changes that need to be made on the current version, I can check back out to git master, make those changes, commit them on git, commit them on SVN, and everything stays clean.
If your svn repo contains tags and branches you could consider using git svn to import your svn repo to a git repo. In any case it's also great to keep the history of your project.
git svn clone -s svn_url dir_for_git
精彩评论