GIT对VS工程中的无用文件过滤

 VS2010工程中的*.vcxproj.filters文件
    
    近日在学习使用Git,其中有一点是clone,主要是以下两个命令行:

    “git clone –bare test test.git”

    “git clone test.git test”

    命令解释参见 Git命令行介绍和使用说明
    使用命令一可以将Git管理的工程test中的镜像文件抽取出来,存储到test.git目录(代码服务器中存储代码的形式)中;然后可以使用命令二从镜像中恢复工程。我遇到的问题是: 从Git控制的镜像中恢复VS2010工程,打开后工程树默认分类的虚拟目录消失。即下图中红色方框中所示目录:
 
只剩下为分类的源码文件。
    原因:在将Test工程提交给Git管理时漏掉了Test.vcxproj.filters这个文件。
    *.vcxproj.filters就是用于项目下文件的虚拟目录,不能丢弃。将其重新添加进来即可。

 

    VS2010中各种类型文件的作用:

    .sln 相当于VC6中 .dsw
    .vcxproj 相当于VC6中 .dsp
    .suo 相当于VC6中 .ncb
    .vcxproj.filters 用于项目下文件的虚拟目录
    .vcxproj.user 是用户的一些相关配置

    其它文件和文件夹(res除外)一般都是中间物,在保存工程时删除不会有大问题。删除一些不重要的文件可以大大减少整个工程文件大小,节省磁盘空间。

    将VS2010工程提交给Git管理时需要哪些文件:

     guyue注: VS2013, 2015的git管理中也是需要这些文件, *.qrc我猜测就是rc文件

    *.h  *.cpp  *.sln  *.vcxproj  *.vcxproj.filters  *.qrc

    以及Resources目录下的资源文件。

    如果使用Git的过滤配置,则还需要.gitignore文件。

    其他的诸如*.suo  *.sdf  *.opensdf  *.vcxproj.user均可以过滤掉!

    guyue注: 即直接把这些通配文件名(*.suo等)添加到.gitignore文件中, 一个一行,  即可实现git过滤


 


      以下为guyue  使用VS2015自带的git管理,    默认生成的.gitignore文件,   按理说只要把下面内容复制到.gitignore文件中, 即可实现git对VS工程的各种文件忽略了

## 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/
[Dd]ebugPublic/
[Rr]elease/
x64/
build/
bld/
[Bb]in/
[Oo]bj/


# Roslyn cache directories
*.ide/


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


#NUNIT
*.VisualState.xml
TestResult.xml


# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c


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


# Chutzpah Test files
_Chutzpah*


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


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


# TFS 2012 Local Workspace
$tf/


# Guidance Automation Toolkit
*.gpState


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


# JustCode is a .NET coding addin-in
.JustCode


# TeamCity is a build add-in
_TeamCity*


# DotCover is a Code Coverage Tool
*.dotCover


# NCrunch
_NCrunch_*
.*crunch*.local.xml


# MightyMoose
*.mm.*
AutoTest.Net/


# Web workbench (sass)
.sass-cache/


# 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
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml


# NuGet Packages Directory
packages/*
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config


# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/


# Windows Azure Build Output
csx/
*.build.csdef


# Windows Store app package directory
AppPackages/


# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/


# 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
*.mdf
*.ldf


# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings


# Microsoft Fakes
FakesAssemblies/


# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值