简体   繁体   English

.git 文件夹可以复制或移动吗

[英]Can the .git folder be copied or moved

I have a folder called application which I intend to run GIT from.我有一个名为application的文件夹,我打算从中运行 GIT。 I will add all files, commit and upload as the master branch.我将添加所有文件,提交和上传作为主分支。

I also have a folder called application_new which is a later version of application and I would like to upload the differences as a later commit/push.我也有一个文件夹,名为application_new这是更高版本application ,我想上传的差异以后提交/推。

I started this project pre-git or thinking about it so my question is: If I copy the hidden .git folder from application to application_new will GIT automatically detect all the changes between my two versions?我开始这个项目 pre-git 或考虑它所以我的问题是:如果我将隐藏的.git文件夹从 application 复制到 application_new,GIT 会自动检测我的两个版本之间的所有更改吗? Or do I need to runs like a "refresh" for GIT to detect the differences?或者我是否需要像“刷新”一样运行 GIT 来检测差异?

You can copy git folder to whatever project you want and it will detect all changes.您可以将 git 文件夹复制到您想要的任何项目,它会检测所有更改。 If that is later version of project I think it will go smooth as one commit.如果那是项目的更高版本,我认为它会像一次提交一样顺利。

Maybe only thing that you might want to pay attention is .gitignore file because if you changed it in meantime you can expect some unexpected behavior, but that should not be problem at all.也许您唯一需要注意的是 .gitignore 文件,因为如果您同时更改它,您可能会出现一些意外行为,但这根本不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM