为什么GitHub有时会忽略我的Visual Studio文件?

时间:2016-12-23 01:27:03

标签: visual-studio visual-studio-2012 github

我正在使用两台带有 Visual Studio Ultimate 2012 Github extension for it的计算机。 存储库中有多个解决方案有时提交后, sln csproj App.config AssemblyInfo.cs 存储库中缺少文件。

我在Gits Gui程序的“ Unstaged Changes ”下找到了它们,并且可以添加它们。 我必须这样做每次我添加新解决方案。

据我所见, .gitignore 文件不负责

## 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/
build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

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

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

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# 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
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# 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
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

这种行为的原因是什么如何修复?

修改以获取更多信息:

我只处理没有分支

我再试一次。 文件未跟踪

$ git status -u 
On branch master 
Your branch is up-to-date with 'origin/master'.  
Untracked files:  
(use "git add <file>..." to include in what will be committed)  

007 10001st prime/10001st prime/10001st prime.sln  
007 10001st prime/10001st prime/10001st prime/10001st prime.csproj  
007 10001st prime/10001st prime/10001st prime/App.config  
007 10001st prime/10001st prime/10001st prime/Properties /AssemblyInfo.cs   

忽略的文件是:

$ git status --ignored
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        007 10001st prime/10001st prime/10001st prime.sln
        007 10001st prime/10001st prime/10001st prime/10001st prime.csproj
        007 10001st prime/10001st prime/10001st prime/App.config
        007 10001st prime/10001st prime/10001st prime/Properties/

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

        005 Smallest multiple/Smallest multiple/Smallest multiple/Smallest multiple.v11.suo
        005 Smallest multiple/Smallest multiple/Smallest multiple/bin/
        005 Smallest multiple/Smallest multiple/Smallest multiple/obj/
        006 Sum square difference/Sum square difference/Sum square difference.v11.suo
        006 Sum square difference/Sum square difference/Sum square difference/bin/
        006 Sum square difference/Sum square difference/Sum square difference/obj/
        007 10001st prime/10001st prime/10001st prime.v11.suo
        007 10001st prime/10001st prime/10001st prime/bin/
        007 10001st prime/10001st prime/10001st prime/obj/

nothing added to commit but untracked files present (use "git add" to track)

似乎不会被忽视,只是未跟踪

1 个答案:

答案 0 :(得分:2)

要确保不会忽略这些文件,请使用

仔细检查(当您再次看到这种情况时)
git check-ignore -v -- /path/to/missing/file.sln

这样,您将确定没有.gitignore负责。

确保您不只是从分支(as in this case

切换