我创建了一个名为 zz 的项目,其中有一个名为 ruby.rb 的文件。我正在使用混帐。我已经将 ruby.rb 添加到暂存区。现在我修改了 ruby.rb 文件并使用 git status
下面是输出。
nikhil@pc:/home/rapps/zz$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: ruby.rb
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ruby.rb~
no changes added to commit (use "git add" and/or "git commit -a")
现在我看到了另一个文件 ruby.rb~,尽管它不是我创建的。是 git 创建这个文件。我在 Internet 上看过教程,但我想我只在我的系统上找到了它。
我在 Ubuntu 10.10 上使用 gedit 和 gmate 插件。
最佳答案
这是一些文本编辑器创建的临时文件。您可能希望创建一个 .gitignore
file自动忽略此类文件以防止它们被意外添加到您的存储库中。你会把
*~
在你的 .gitignore
文件中排除所有以波浪号结尾的文件。
关于ruby - git是否创建额外的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5409745/