Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
移动整个git目录_Git_Github - Fatal编程技术网

移动整个git目录

移动整个git目录,git,github,Git,Github,我在~/.emacs.d/中初始化了git,并将其与github repo连接。现在我意识到我不需要让我的个人.emacs.d/成为推送的主人,相反,我需要创建我的.emacs.d/的“不可知”非个性化版本。我可以简单地将整个~/.emacs.d/目录--.git和所有目录--复制到一个新位置,比如说,~/pure/.emacs.d/,并开始使用它作为原始github repo的基础吗?或者,.git中是否有东西将它绑定到原始的`~/.emacs.d/位置?不,git中没有基于路径的绑定。包含.

我在
~/.emacs.d/
中初始化了
git
,并将其与github repo连接。现在我意识到我不需要让我的个人
.emacs.d/
成为推送的主人,相反,我需要创建我的
.emacs.d/
的“不可知”非个性化版本。我可以简单地将整个
~/.emacs.d/
目录--
.git
和所有目录--复制到一个新位置,比如说,
~/pure/.emacs.d/
,并开始使用它作为原始github repo的基础吗?或者,
.git
中是否有东西将它绑定到原始的`~/.emacs.d/位置?

不,git中没有基于路径的绑定。包含
.git
的目录将是存储库的根目录。您可以在根目录中移动,而不会丢失任何内容

那就这么做吧

cp -R ~/.emacs.d ~/pure/
您可以在~/pure/.emacs.d中签出分支

cd ~/pure/.emacs.d && git checkout master

您可以使用此新路径合并“不可知”更改,同时保持旧提交的完整性

rm-rf~/.emacs.d/.git