StackOverflow社区!我不能忽略具有特定名称的文件:list.vtk.1,list.vtk.2,list.vtk.3等。我尝试将list.vtk。*添加到.gitignore,但它不起作用。我输入git status时会看到文件。如何处理变量扩展?
在.gitignore:
# data files
out
*.vtk
list.vtk.*
log.*
*.log
*log
.idea
dump-*
输出是
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: 2phase_new/Makefile
new file: embed_2phase/embed_2phase.c
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.0
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.1
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.10
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.11
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.12
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.13
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.14
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.15
new file: two_phase_flow_cylinders/results/Ox=10_No_BC_effects/list.vtk.16
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../.gitignore
deleted: two_phase_flow_cylinders/results/Oy mmm/list.vtk.0
deleted: two_phase_flow_cylinders/results/Oy mmm/list.vtk.1
deleted: two_phase_flow_cylinders/results/Oy mmm/list.vtk.10
Untracked files:
(use "git add <file>..." to include in what will be committed)
../scratch.cpp
2phase_new/parout
2phase_new/results/manycyls_front/flow.avi
2phase_new/results/manycyls_front/flow.mp4
paraview/reserve
reversed_3f-implicit/diff
reversed_3f-implicit/f2
reversed_3f-implicit/f3
你的.gitignore
模式list.vtk.*
工作得很好,但是
git add
。因此他们被列为new file
。像git本身所暗示的那样做一个git reset HEAD <file>
。deleted
。像git本身所暗示的那样做一个git rm <file>
。.gitignore
机制仅适用于将在Untracked files:
部分列出的文件。一旦跟踪它们,.gitignore
就不再适用了。