首页 > 解决方案 > Pattern to remove a specific "/Folder/File.Ext" path combination in GIT

问题描述

My current GIT branch has some projects, all of them with "Debug" folders inside, that also contain .XML files I don't want to track.

Too late I noticed they all have got into my GIT index, and I want to remove them. I tested the bash command:

$ git rm --dry-run --cached "**/bin/Debug/*.xml"

But it shows that also undesirable subfolders will be included, as noted here (see file3.xml):

D:\TestFolder\Project\bin\Debug\file1.xml
D:\TestFolder\Project\bin\Debug\file2.xml
D:\TestFolder\Project\bin\Debug\AnotherFolder\file3.xml     <--- !!!!
D:\TestFolder\Project\bin\Debug\file4.xml

Which search pattern will avoid file3.xml being included in the remove operation?

标签: gitpattern-matching

解决方案


推荐阅读