0

I have the following directory structure:

Application/V1
Application/V2
Application/V3

None of these directories are Git repositories. I can also add that each of these directories contain exactly the same files (but the code in these files obviously changes)

From that, I would like to create a new git repository with 3 branches being V1, V2 and V3.

I was thinking of creating a new directory which would contain a .git file in which I could checkout the 3 git branches (i.e a real Git repo). So, my question is: even if this manipulation is not git-friendly at all, how can I achieve this in an elegant way?

4

1 回答 1

1

这是我带来的工作解决方案(但如果可能的话,我仍在寻找更优雅的解决方案)

mkdir gitDir
cd gitDir
git init

cp -r ../V1/*
git add * 
git commit -am "Init Commit for V1"
git branch -m V1

git checkout -b V2
rm -rf *
cp -r ../V2/*
git commit -am "Commit for V2"

git checkout -b V3
rm -rf *
cp -r ../V3/*
git commit -am "Commit for V3"
于 2013-04-30T02:02:37.197 回答