简体   繁体   English

Git推送到已有文件的遥控器

[英]Git push to a remote with files already there

I would like to start using git on a website that already has a lot of content on it (like tens of GB of videos and photos). 我想开始在已经有很多内容的网站上使用git(比如几十GB的视频和照片)。 I have all the source codes (PHP, HTML etc.) stored locally on my computer. 我将所有源代码(PHP,HTML等)存储在我的计算机上。

I like this solution for git deployment but I'm afraid that git is going to delete the multimedia files on that remote server (if they are not in a repository git). 我喜欢这个git部署的解决方案,但我担心git会删除该远程服务器上的多媒体文件(如果它们不在存储库git中)。

I have put folders with photos and videos to gitignore. 我把带有照片和视频的文件夹放到gitignore。

So the question is: If there are files already in a GIT_WORK_TREE after you set up a bare repository, are they going to be deleted after you push? 所以问题是:如果在设置裸存储库后GIT_WORK_TREE中已经存在文件,那么在推送后它们是否会被删除? Or could they be deleted somehow? 或者他们可能会以某种方式被删除?

On checkout Git won't touch anything that is not tracked, so you're safe. 在结账时,Git不会触及任何未被跟踪的东西,所以你很安全。

You should maybe avoid the -f (force) flag to the checkout command, so that if you have untracked files that get tracked in a push, git will ask you for confirmation to overwriting them. 你应该避免使用checkout命令的-f (强制)标志,这样如果你有未经跟踪的文件在推送中被跟踪,git会要求你确认要覆盖它们。

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

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