简体   繁体   English

Ubuntu git 备份文件

[英]Ubuntu git backup file

I am learning git, and I am a beginner.我正在学习git,我是初学者。 I have just finished CodeCademy's Git course ( https://www.codecademy.com/learn/learn-git ), so I wanted to try something on my computer.我刚刚完成了 CodeCademy 的 Git 课程( https://www.codecademy.com/learn/learn-git ),所以我想在我的电脑上尝试一些东西。 I initialized a new git repository.我初始化了一个新的 git 存储库。 Then I changed the a.txt file, but there appeared a new file, 'a.txt~', which I found is a backup file.然后我更改了a.txt文件,但是出现了一个新文件'a.txt~',我发现它是一个备份文件。 After adding and committing, the file is still there.添加并提交后,文件仍然存在。 I am still a total beginner in GIT.我仍然是 GIT 的初学者。 I have no idea what is going on.我不知道发生了什么。 But I guess this shouldn't be happening.但我想这不应该发生。 What should I do to prevent this in the future?我应该怎么做才能防止将来发生这种情况? I don't think deleting it all the time is a good idea.我不认为一直删除它是个好主意。

在此处输入图片说明

The backup file is created by the editor, not git.备份文件是由编辑器创建的,而不是 git。 It is just another file.它只是另一个文件。 In your figure, you created an empty repository and there are three files in the working directory (a.txt, b.txt, README.txt).在您的图中,您创建了一个空存储库,工作目录中有三个文件(a.txt、b.txt、README.txt)。 You edited a.txt with gedit, and now there are 4 files (a.txt, a.txt~, b.txt, README.txt).你用gedit编辑了a.txt,现在有4个文件(a.txt、a.txt~、b.txt、README.txt)。 You added a.txt and committed it to the repository.您添加了 a.txt 并将其提交到存储库。 The status now says that there are three other files that it doesn't know about, because they haven't been added to the repository.状态现在说还有其他三个文件它不知道,因为它们还没有被添加到存储库中。

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

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