1

我正在处理一个已移至 GitHub 存储库的项目,该项目在项目库中有一些重大更新。但是那些在同一项目基础上工作的人只有未更新的版本。那么如何将他们的本地非 git repo 转换为本地 git repo并使用同一项目的新版本更新它们。

我已经浏览了git的所有文档,但我仍然不清楚

4

2 回答 2

0

一种方法是:

于 2013-01-24T08:22:10.677 回答
0

为了保留他们的工作,最好的方法是:

# current dir is ~/oldversion
# create a new directory 
mkdir ~/newversion
# get the clean versioned project
git clone git@github.com:Your/repo .
# create a new local branch and go on it
git checkout -b migration
# now copy everything from the old project. the modified files will appear with "git status"
cp -r ../oldversion/* ./
# commit the last work
git commit --all -m "importing to git"
# now, make some checks/editio, git diff, git rm, git revert, git checkout path/to/file whatever
...
# then import your work in a branch for everyone, if you use master that means
git checkout master
git merge migration --no-ff -m "migrated by me"

如果使用了 scm,您可能更愿意在某一时刻排除一些文件,例如 .svn 目录。

于 2013-01-24T10:10:18.643 回答