Just started using git on my mac. I have one file in my repository called README
. When I change it, git puts another file in the directory called README~
containing the previous version.
.gitignore
, but I guess I could do that but I'd rather understand why I'm getting these files in the first place..)(It's hard to search for an answer on Google cos of trying to search on "~")
Run 'git clean -n' to see a dry run; Run 'git clean -f' to force untracked file deletion; Use 'git clean -f -d' to remove untracked directories; Use 'git clean -f -x' to remove untracked .
To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The git rm command does that, and also removes the file from your working directory so you don't see it as an untracked file the next time around.
simply typing git status gives you a list of staged files, a list of modified yet unstaged files, and a list of untracked files. @houtanb, git status shows you a diff. (It doesn't show you all staged files).
If git status mentions "Untracked files:", you may need to add one or more untracked files. This status message is OK. We are up-to-date, there is nothing to commit, but there is still an untracked file.
The tilde suffix on file names is usually used by editors (Emacs, Vim in some modes/versions) on backup copies of files you edit. At one time on Mac, Vim seemed to create backups for me; it doesn't any more, but I'm not sure now whether that's because I tweaked a setting somewhere or whether vim changed its behaviour.
I have not seen git add tilde suffixes to file names (either on a Mac where I work mainly, or anywhere else).
To stop git wanting to add the files, add a line containing just *~
to .gitignore
.
Vim has (at least) three settings related to this:
nobackup
backupcopy=auto
backupext=~
My ':set all
' shows the values above. Yours probably shows 'backup
' rather than 'nobackup
'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With