开发者

file mask to exclude *.m.swp files in git

When I run git status, *.m.swp files are showing up in the "untracked list" because I currently have these files open in MacVim (The originals are MATLAB files with *.m f开发者_开发问答ile extensions).

I have tried adding *.m.swp, and various permutations of this, to my .gitignore file so that the files are ignored, but nothing seems to work for me.

See an example of git status output below:

git status
# On branch mybranch1
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   ../dir1/file1.m
#   new file:   file2.m
#   new file:   file3.m
#   modified:   file4.m
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   ../../dir2/.file5.m.swp
#   ../dir1/.file6.m.swp
#   ../dir1/.file1.m.swp
#   ../dir1/.file7.m.swp
#   ../dir1/.file8.swp
#   .file9.m.swp
#   .file4.m.swp

How can I get git to ignore these? Thanks in advance for any help!


.*.m.swp

should work: I have tested it in my msysgit1.7.4 environment.
So: not "*..." but ".*...".

Don't forget to add your modified .gitignore to the index before doing a new git status.


.*\\.m\\.swp

do this instead, since unescaped .'s match anything

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜