I'm having issues with my .gitignore file. I have done my research and have tried many methods. The steps below happen when I save my .gitignore
git rm -rf --cached *.php.*
git add .
git status
git commmit -m "some message"
Here's is what my .gitignore file looks like:
# Ignores anything that's a temp file created by vim
.*.s??
.*.*.s??
Here are the files it should be keeping from being tracked
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .ajax.php.swn
# .ajax.php.swo
# .ajax.php.swp
# .swervepay.php.swn
# .swervepay.php.swo
# .swervepay.php.swp
# .swervepay_form.php.swm
# .swervepay_form.php.swn
# .swervepay_form.php.swp
What can I do to keep these files from gettin tracked? Everytime I do a git add . and commit to push up, those files get re-added. Any help would be greatful.
There's a handy repository on github for ignore rules, for Vim the rules are:
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
The best way to make use of rules like this are to put them in your global git ignore file:
git config --global core.excludesfile ~/.gitignore
However it's probably a better idea to do this:
" ~/.vimrc file
" swap files (.swp) in a common location
" // means use the file's full path
set dir=~/.vim/_swap//
" backup files (~) in a common location if possible
set backup
set backupdir=~/.vim/_backup/,~/tmp,.
" turn on undo files, put them in a common location
set undofile
set undodir=~/.vim/_undo/
In this way vim won't be polluting your working copies with files, ignored or not =).
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