简体   繁体   中英

Ubuntu git backup file

I am learning git, and I am a beginner. I have just finished CodeCademy's Git course ( https://www.codecademy.com/learn/learn-git ), so I wanted to try something on my computer. I initialized a new git repository. Then I changed the a.txt file, but there appeared a new file, 'a.txt~', which I found is a backup file. After adding and committing, the file is still there. I am still a total beginner in 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. 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). You edited a.txt with gedit, and now there are 4 files (a.txt, a.txt~, b.txt, README.txt). You added a.txt and committed it to the repository. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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