开发者

Does git create extra files

开发者 https://www.devze.com 2023-02-19 12:03 出处:网络
I have created a project called zz and it has a single file called ruby.rb in it. I am using git. I have already added ruby.rb to the staging area. Now I have modified the ruby.rb file and using git s

I have created a project called zz and it has a single file called ruby.rb in it. I am using git. I have already added ruby.rb to the staging area. Now I have modified the ruby.rb file and using git status below is the output.

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")

Now I see another file ruby.rb~ even though, I did not created it. Is git creating this file. I have seen tutorials on Internet and I think I have found this on my system only.

I'm on Ubuntu 10.10 using gedit with gmate plug-gins.


That's a temporary file created by some text editors. You may wish to create a .gitignore file to automatically ignore such files to prevent them from accidentally being added to your repository. You would put

*~

in your .gitignore file to exclude all files ending with a tilde.


Git does not create these files on my system, but I know gedit has a back-up system. If you disable the backup in gedit's preferences, the files should not be created again.

You can put this into the .gitignore file so git won't commit them:

*~


No, Git does not create files like ruby.rb~ This is a common method text editor applications do to save backups of the currently edited file.


No, git is not adding this file. It is likely being used as a file buffer or backup by your text editor. If you close your text editor, does the file disappear?

Git won't ever add a file or change the file system of your repository except in the .git directory, which Git knows to treat different.

0

精彩评论

暂无评论...
验证码 换一张
取 消