Git Tips

来源:互联网 发布:淘宝网天猫女手提包 编辑:程序博客网 时间:2024/06/17 07:15

.gitignore

CSharp

## 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/# 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 filesipch/*.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-inDocProject/buildhelp/DocProject/Help/*.HxTDocProject/Help/*.HxCDocProject/Help/*.hhcDocProject/Help/*.hhkDocProject/Help/*.hhpDocProject/Help/Html2DocProject/Help/html# Click-Once directorypublish/# Publish Web Output*.Publish.xml*.pubxml# NuGet Packages Directory# Enable nuget packages restore when building!packages/packages/*!packages/repositories.config# Windows Azure Build Outputcsx*.build.csdef# Windows Store app package directoryAppPackages/# Otherssql/*.CacheClientBin/[Ss]tyle[Cc]op.*~$**~*.dbmdl*.[Pp]ublish.xml*.pfx*.publishsettings# RIA/Silverlight projectsGenerated_Code/#Visual Studio LightSwitch_Pvt_Extensions/GeneratedArtifacts/ServiceConfiguration.cscfgModelManifest.xmlgenerated.parameters.xml## TODO: Comment the next line if you want version controls the generated client .xap file*.Client.xap# 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*.XMLUpgradeLog*.htm# SQL Server filesApp_Data/*.mdfApp_Data/*.ldf# =========================# Windows detritus# =========================# Windows image file cachesThumbs.dbehthumbs.db# Folder config fileDesktop.ini# Recycle Bin used on file shares$RECYCLE.BIN/# Mac crap.DS_Store

常用命令

git commit -a

这个命令可以直接提交所有修改,省去了你git add和git diff和git commit的工序,但有新增文件不行。

git config --global credential.helper cache 记住密码,默认15分钟git config credential.helper 'cache --timeout=3600' 记住密码,指定时长,单位秒git config --global credential.helper store 长期储存密码

放弃本地修改:

git stash save --keep-index

参考:

https://github.com/kaedei/gitignore/blob/master/VisualStudio.gitignore

常见错误处理

  • AutoCRLF SafeCRLF
一、AutoCRLF#提交时转换为LF,检出时转换为CRLFgit config --global core.autocrlf true   #提交时转换为LF,检出时不转换git config --global core.autocrlf input   #提交检出均不转换git config --global core.autocrlf false二、SafeCRLF#拒绝提交包含混合换行符的文件git config --global core.safecrlf true   #允许提交包含混合换行符的文件git config --global core.safecrlf false   #提交包含混合换行符的文件时给出警告git config --global core.safecrlf warn
  • 错误信息
Your local changes to the following files would be overwritten by merge

可以选择放弃本地修改或覆盖。

  • 错误信息
git  Your console font probably doesn't support Unicode.

执行

git config --global core.quotepath offgit config --global --unset i18n.logoutputencodinggit config --global --unset i18n.commitencoding
  • 错误信息
You have not concluded your merge (MERGE_HEAD exists).Please, commit your changes before you can merge.

执行:

1.保留你本地的修改git merge --abortgit reset --merge合并后记得一定要提交这个本地的合并然后在获取线上仓库git pull2.down下线上代码版本,抛弃本地的修改不建议这样做,但是如果你本地修改不大,或者自己有一份备份留存,可以直接用线上最新版本覆盖到本地git fetch --allgit reset --hard origin/mastergit fetch
0 0
原创粉丝点击