git

来源:互联网 发布:买彩票的软件 编辑:程序博客网 时间:2024/05/16 17:06

git reset --hard HEAD 回退最高版本

git reset --hard HEAD^回退当前版本上一个版本

git reset --hard 13456回退版本库中的13456

git checkout x.h把当前版本库的x.h文件提取出来

git reflog查看回退版本库的日志

git log --stat 可以查看到提交日志的详情



git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"  配置lg输出带颜色


git config --global core.excludesfile $HOME/.config/git/ignore配置全局忽略的文件


git config --global core.editor notepad 配置编辑器


git rm -r 仓库路径(路径是有区分大小写的)会将物理的文件以及仓库的文件一起删除


git rm -r --cache 仓库路径(缓冲文件,未提交的文件,也支持,路径是有区分大小写)  只会删除仓库的文件,物理的文件不会删除


git ls-files查看有什么文件在仓库版本控制中


git config --gobal core.autocrlf false  取消git对LF换行符自动转换CRLF换行符(在windows,git提交会自动转换)


.gitignore文件在仓库初始化后应该立刻放在仓库中(与.git文件夹保持同一个文件夹层次),这样子才生效


git clean -df git的仓库缓存进行清理,会腾出一定的硬盘空间


%USERPROFILE% 路径是当前windows登陆的用户的账号路径C:\Users\Administrator,可以在cmd中调用echo %USERPROFILE%查看


git config --global core.excludesfile '~/.gitignore' *nix 和 windows git bash工具中设置全局忽略文件


git config --global core.excludesfile在windows cmd中"%USERPROFILE%\.gitignore"设置全局忽略文件


git branch 查看本地分支

git branch -a 查看远程分支

git checkout 分支名称分支切换


git的复制整个工程用beyond compare比较注意设置如下比较方便,解决文件一致时候显示红色的效果


gitingore配置

## Ignore Visual Studio temporary files, build results, and## files generated by popular Visual Studio add-ons.#### Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore# User-specific files*.suo*.user*.userosscache*.sln.docstates# User-specific files (MonoDevelop/Xamarin Studio)*.userprefs# Build results[Dd]ebug/[Dd]ebugPublic/[Rr]elease/[Rr]eleases/x64/x86/bld/#Neko修改[Bb]in/*.Intermediate/[Oo]bj/[Ll]og/# Visual Studio 2015 cache/options directory.vs/# Uncomment if you have tasks that create the project's static files in wwwroot#wwwroot/# MSTest test Results[Tt]est[Rr]esult*/[Bb]uild[Ll]og.*# NUNIT*.VisualState.xmlTestResult.xml# Build Results of an ATL Project[Dd]ebugPS/[Rr]eleasePS/dlldata.c# .NET Coreproject.lock.jsonproject.fragment.lock.jsonartifacts/**/Properties/launchSettings.json*_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 filesipch/*.aps*.ncb*.opendb*.opensdf*.sdf*.cachefile*.VC.db*.VC.VC.opendb# Visual Studio profiler*.psess*.vsp*.vspx*.sap# 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 add-in.JustCode# TeamCity is a build add-in_TeamCity*# DotCover is a Code Coverage Tool*.dotCover# Visual Studio code coverage results*.coverage*.coveragexml# NCrunch_NCrunch_*.*crunch*.local.xmlnCrunchTemp_*# MightyMoose*.mm.*AutoTest.Net/# Web workbench (sass).sass-cache/# 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*.[Pp]ublish.xml*.azurePubxml# TODO: Comment the next line if you want to checkin your web deploy settings# but database connection strings (with potential passwords) will be unencrypted*.pubxml*.publishproj# Microsoft Azure Web App publish settings. Comment the next line if you want to# checkin your Azure Web App publish settings, but sensitive information contained# in these scripts will be unencryptedPublishScripts/# NuGet Packages*.nupkg# The packages folder can be ignored because of Package Restore**/packages/*# except build/, which is used as an MSBuild target.!**/packages/build/# Uncomment if necessary however generally it will be regenerated when needed#!**/packages/repositories.config# NuGet v3's project.json files produces more ignorable files*.nuget.props*.nuget.targets# Microsoft Azure Build Outputcsx/*.build.csdef# Microsoft Azure Emulatorecf/rcf/# Windows Store app package directories and filesAppPackages/BundleArtifacts/Package.StoreAssociation.xml_pkginfo.txt# Visual Studio cache files# files ending in .cache can be ignored*.[Cc]ache# but keep track of directories ending in .cache!*.[Cc]ache/# OthersClientBin/~$**~*.dbmdl*.dbproj.schemaview*.jfm*.pfx*.publishsettingsorleans.codegen.cs# Since there are multiple workflows, uncomment next line to ignore bower_components# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)#bower_components/# RIA/Silverlight projectsGenerated_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*.XMLUpgradeLog*.htm# SQL Server files*.mdf*.ldf*.ndf# Business Intelligence projects*.rdl.data*.bim.layout*.bim_*.settings# Microsoft FakesFakesAssemblies/# GhostDoc plugin setting file*.GhostDoc.xml# Node.js Tools for Visual Studio.ntvs_analysis.datnode_modules/# Typescript v1 declaration filestypings/# Visual Studio 6 build log*.plg# Visual Studio 6 workspace options file*.opt# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)*.vbw# Visual Studio LightSwitch build output**/*.HTMLClient/GeneratedArtifacts**/*.DesktopClient/GeneratedArtifacts**/*.DesktopClient/ModelManifest.xml**/*.Server/GeneratedArtifacts**/*.Server/ModelManifest.xml_Pvt_Extensions# Paket dependency manager.paket/paket.exepaket-files/# FAKE - F# Make.fake/# JetBrains Rider.idea/*.sln.iml# CodeRush.cr/# Python Tools for Visual Studio (PTVS)__pycache__/*.pyc# Cake - Uncomment if you are using it# tools/**# !tools/packages.config# Telerik's JustMock configuration file*.jmconfig# BizTalk build output*.btp.cs*.btm.cs*.odx.cs*.xsd.cs
.gitconfig

[user]name = xxemail = xx@163.com[alias]s = statuscm = commit -mlg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit[core]editor = notepadautocrlf = falseexcludesfile = ~/.gitignore

git add . 如果总是提示warning: LF will be replaced by CRLF

请确认提示的文件下有没有.gitattributes ,.gitignore,.gitmodules因为这些文件的配置会重置你的git的配置

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

这种配置会导致autocrlf = false无效,因为给重置了


Git-2.13.3-64-bit.exe

*.vcproj.*.user 增加此忽略导致程序在提交的时候卡死

0 0
原创粉丝点击