我如何将本地未版本化的代码与git远程仓库相关联? [英] How can I associate local unversioned code to git remote repository?
问题描述
我需要将干净的未版本化代码关联到现有的git远程存储库。
我更好地解释我的情况。
我的项目从svn移动到git。我有一个svn本地工作副本与旧代码(没有新提交),必须与新的git存储库同步。我可以克隆回购,但我应该手工恢复许多被忽略的配置文件,我会避免它。
所以我删除了所有的.svn目录,我会跟踪我的代码git远程仓库。
有没有办法做到这一点?
好吧,
我根据 Adam Dymitruk 和 Eugene Sajine 的回答。感谢大家的支持:)
- 首先,删除所有
.svn
工作副本目录中的目录;
-
在工作副本目录中初始化新的git存储库
cd / path / to / my / project
git init
-
添加git远程仓库并获取它
git remote add origin url -to-your-remote
git fetch origin
-
重置工作副本到远程存储库
git reset --hard origin / master
最后,本地存储库将与远程存储库同步。
I need to associate a clean unversioned code to an existing git remote repository.
I explain better my situation. My project is moved from svn to git. I have a svn local working copy with old code (nothing new to commit) that has to be syncronized with the new git repository. I could clone the repo but I should restore many ignored configuration files by hand and I would avoid it.
So I removed all .svn directories and I would track my code with the git remote repository.
Is there a way to do it?
Ok, I post the right answer for my question based on Adam Dymitruk and Eugene Sajine answers. Thanks everyone for the support :)
- First of all, remove all
.svn
directories in working copy directory; initialize new git repository in the working copy directory
cd /path/to/my/project git init
add git remote repository and fetch it
git remote add origin url-to-your-remote git fetch origin
reset working copy to remote repository
git reset --hard origin/master
At the end local repository will be synchronized with remote repository.
这篇关于我如何将本地未版本化的代码与git远程仓库相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!