问题:
I have a non-empty directory (eg /etc/something) with files that cannot be renamed, moved, or deleted. 我有一个非空目录(例如/ etc / something),其中包含无法重命名,移动或删除的文件。
I want to check this directory into git in place. 我想将这个目录检查到git中。
I want to be able to push the state of this repository to a remote repository (on another machine) using "git push" or something similar. 我希望能够使用“git push”或类似的东西将此存储库的状态推送到远程存储库(在另一台计算机上)。
This is trivial using Subversion (currently we do it using Subversion) using: 这很简单,使用Subversion(目前我们使用Subversion),使用:
svn mkdir <url> -m <msg>
cd <localdir>
svn co <url> .
svn add <files etc>
svn commit -m <msg>
What is the git equivalent? 什么是git等价物?
Can I "git clone" into an empty directory and simply move the .git directory and have everything work? 我可以“git clone”到一个空目录中,只需移动.git目录并使一切正常吗?
解决方案:
参考一: https://stackoom.com/question/DtXi/如何将现有的非空目录转换为Git工作目录并将文件推送到远程存储库参考二: https://oldbug.net/q/DtXi/How-to-convert-existing-non-empty-directory-into-a-Git-working-directory-and-push-files-to-a-remote-repository
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4274382