Sourcetree / Git .ignore文件 - 不会忽略解决方案中的packages文件夹

时间:2014-02-01 22:04:40

标签: git visual-studio github atlassian-sourcetree

我有一个设置,SourceTree一直在说我有一个未经注释的文件列表。这些未经注释的文件是我的包文件夹中的各种文件。

在我的.gitignore中,我非常相信包文件夹是被排除的,这是我一直使用的设置和工作。但是,这看起来很奇怪。

我有一个结构:

/ git_project /

在我的git_project中,我有:

/ SRC

的.gitignore

在我的/ src文件夹中,我的项目包含以下文件夹:

enter image description here

预期提交的屏幕截图:

enter image description here

这是我的全局Git忽略文件:

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr

这是我当地的Git文件:

# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.


# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder 
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
[Bb]in
[Oo]bj
UserData

src/packages


sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

1 个答案:

答案 0 :(得分:3)

第一次尝试更改您的gitignore文件

packages

packages/

然后如果packages文件夹中的文件已经在git中,请执行以下操作

git rm -r --cached packages
git commit

它会从git中删除文件,但不会从磁盘中删除