最近开始使用git ......只是注意到我的文件克隆以'〜'结尾......为什么会发生这种情况 [英] Started using git recently ... just noticed clones of my files with ' ~ ' appended in the end... why is this happening
问题描述
我使用git在我的仓库中提交更改,
I used git to commit changes in my repository,
遵循这些步骤
followed these steps
git add .
git commit -m "message"
但注意到文件的一个克隆,也存在于存储库中
新文件在末尾附加了<〜
'符号。
but noticed a clone of the file where changes were made also present in the repository
new file had '~
' symbol appended at the end.
为什么会发生?我怎样才能在将来防止它?
也想到如何删除文件的〜会很好
why did this happen ? And how can I prevent it in the future ?
Also some thoughts on how to remove the file with "~" would be great
谢谢
推荐答案
您的编辑器正在生成FILENAME〜形式的备份文件。 (Emacs这样做;否则就可以说服它。)你没有要求git忽略以〜结尾的文件。使用 git add。
你告诉git添加所有你没有要求它忽略的东西。
Your editor is generating backup files of the form FILENAME~. (Emacs does this; it can be persuaded otherwise.) You have not asked git to ignore files ending in ~. With git add .
you're telling git to add everything that you haven't asked it to ignore.
另见:
gitignore
这篇关于最近开始使用git ......只是注意到我的文件克隆以'〜'结尾......为什么会发生这种情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!