git 格式:

git [--version] [--exec-path[=<path>]] [--html-path] [--info-path]

[-p|--paginate|--no-pager] [--no-replace-objects] [-bare]

[--git-dir=<path>] [--work-tree=<path>][--namespace=<name>]

<command> [<args>]

最常用的git命令解说如下:

add

说明:git add <path> 添加文件内容到索引库,文件内容包括新添或修改(不包括已删除)的文件,并把它们的信息添加到索引库中。注:省略<path>,说明是当前目录;

Description:

git add -u [<path>]   #把<path>中所有tracked文件中被修改过或已删除文件的信息添加到索引库。它不会处理untracted的文件。

git add -A:  [<path>]   #把<path>中所有tracked文件中被修改过或已删除文件和所有untracted的文件信息添加到索引库。

git add -i [<path>]     #查看<path>中被所有修改过或已删除文件但没有提交的文件,过其revert子命令可以查看<path>中所有untracted的文件,同时进入一个子命令系统。

详情查看:http://blog.csdn.net/joe_007/article/details/7889173

bisect

说明:Find by binary search the change that introduced a bug,大意是说通过二分查找的方式快速定位引入Bug的版本;

Eg:git bisect <subcommand> <options>

git bisect help
git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
git bisect bad [<rev>]
git bisect good [<rev>...]
git bisect skip [(<rev>|<range>)...]
git bisect reset [<commit>]
git bisect visualize
git bisect replay <logfile>
git bisect log
git bisect run <cmd>...

详情可参考以下文章

https://www.kernel.org/pub/software/scm/git/docs/git-bisect.html

http://crazycode.iteye.com/blog/311564

http://git-scm.com/docs/git-bisect

branch

说明:List,Create,or delete  branches ;

Eg:

git branch       #查看当前分支的状态

checkout

说明:Checkout a branch or paths to the working tree ;

Eg1:

检出命令git checkout是git最常用的命令之一,同时也是一个很危险的命令,因为这条命令会重写工作区。检出命令的用法如下:

用法一:git checkout [-q] [<commit>] [--] <paths>...

用法二:git checkout [<branch>]

用法三:git checkout [-m] [[-b]--orphan] <new_branch>] [<start_point>]

Eg2:

  正确切换分支的思路

  如果本地分支存在问题,需要删除,有两种方式

  第一种:git  branch -d   <branch_name>    # 删除分支,如果还存在未提交的代码,可能会删除失败

  第二种:git  branch -D  <branch_name>     # 强制删除本地分支

  切换分支的两种场景:

  第一种:git checkout   <branch_name>      # 切换到本地已经存在的分支上去

  第二种:git checkout  -b <branch_name>   # 切换到指定分支上,如果该分支不存,则基于当前分支,创建新分支

  第三种:git  checkout -b <new_branch_name>  <origin_branch_name>  # 基于分支<origin_branch_name>创建新的本地分支,并切换到该分支上;

      eg: git checkout -b develop origin/develop    # 基于远程分支“origin/develop“,创建本地新分支“develop”

详情参考:http://www.cnblogs.com/craftor/archive/2012/11/04/2754147.html

clone:

说明:Clone  a repository into a new directory ;

详细参考:http://blog.csdn.net/hudashi/article/details/7664396

commit:

说明:Record changes to the repository;

使用实例:

diff:

说明:Show changes between commits , commit and working tree,etc;

使用实例:

fetch:

说明:Download objects  and refs  from another repository ;

使用实例:

grep:

说明:print lines matcing a pattern ;

Eg:

详情参考:http://git-scm.com/docs/git-grep

init:

说明:Create an ampty git repository or reinitialize  an existing one ;

log:

说明:Show commit logs ;

merge:

说明:Join two or more development historise  together ;

Eg:

mv:

说明:Move  or rename a file , a directory, or a symlink ;

使用实例:

pull:

说明:Fetch from and merge with another repository or a local branch ;

Eg:

push:

说明:Update remote refs along with associated  objects ;

Eg:

rebase:

说明:Forward-port local commits to the updated upstream head ;

使用实例:

reset:

说明:Reset current HEAD to the specified stated ;

rm:

说明:Remove files from the working tree and from the index ;

show:

说明:Show various types of  objects ;

status:

说明:Show the working types of objects ;

tag:

说明:Create,list,delete or verify a tag object signed with GPG;

以上使用详情,可参考官方文档:http://git-scm.com/docs/

github之git基本命令介绍的简单整理的更多相关文章

  1. 在Github和Git上fork之简单指南

    http://www.linuxidc.com/Linux/2014-11/109785.htm 以我的经验来看,刚接触Git和GitHub时,最困扰的一件事情就是尝试解决下面的问题:在Git和Git ...

  2. GIT基本命令介绍

    1.git remote git remote -v| --verbose 查看仓库详细信息 git remote add <name> <url> 关联远程库.如果你本地新建 ...

  3. DSOframer 的简单介绍和资源整理

    DSOframer 是微软提供一款开源的用于在线编辑 Word. Excel .PowerPoint 的 ActiveX 控件.国内很多著名的 OA 中间件,电子印章,签名留痕等大多数是依此改进而来的 ...

  4. git工具使用的简单介绍

    百度百科 写道 Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git的读音为/gɪt/. Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大 ...

  5. DSOframer 的简单介绍和资源整理(2015-09-02重新整理)

    DSOframer 是微软提供一款开源的用于在线编辑 Word. Excel .PowerPoint 的 ActiveX 控件.国内很多著名的 OA 中间件,电子印章,签名留痕等大多数是依此改进而来的 ...

  6. GitHub的SSH key配置以及常用的git命令介绍

    一. GitHub的SSH key配置 (以windows为例,Mac iOS系统类似) SSH Key 是一种方法来确定受信任的计算机,从而实现免密码登录.Git是分布式的代码管理工具,远程的代码管 ...

  7. Git基本命令行操作 (转)

    Git远程操作详解   作者: 阮一峰 Git是目前最流行的版本管理系统,学会Git几乎成了开发者的必备技能. Git有很多优势,其中之一就是远程操作非常简便.本文详细介绍5个Git命令,它们的概念和 ...

  8. [Git]代码管理工具简单使用

    1 Git简介 Git是分布式的版本控制系统,是Linux内核开发者林纳斯·托瓦兹(Linus Torvalds)为更好地管理Linux内核开发而设计.与CVS.Subversion一类的集中式版本控 ...

  9. 【转】GitHub平台最火Android开源项目整理——2013-08-25 17

    http://game.dapps.net/news/developer/9199.html GitHub在中国的火爆程度无需多言,越来越多的开源项目迁移到GitHub平台上.更何况,基于不要重复造轮 ...

随机推荐

  1. .net 执行sql包含go语句的处理

    今天工作中遇到了这个问题,其实只要把GO替换成“;”就行了,其它人写的例子用Split来拆分这一个脚本文件的内容,完全没有必要

  2. Codeforces Round #342 (Div. 2) A. Guest From the Past(贪心)

    传送门 Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the detai ...

  3. 分析移动端APP的网络请求抓包

    为了方便,本文以 iOS 系统来进行演示. 使用代理 移动操作系统中都有可以设定系统代理的设置,比如在 iOS 中可以通过 Settings->WLAN 看到很多 Networks,通过点击它们 ...

  4. wcf第4步之原生调用简单封装

    public interface IDemoServiceChannel : IDemoService, System.ServiceModel.IClientChannel { } public p ...

  5. Python Day1

    一.安装python windows 1.下载安装包 https://www.python.org/downloads/ 2.安装 默认安装到C盘下 3.配置环境变量 右键计算机属性---高级系统设置 ...

  6. 简明Linux命令行笔记:mv

    重命名.覆盖或移动文件 mv [options] existing-file new-filename mv [options] existing-file-list directory mv [op ...

  7. jquery ajax beforeSend 提交等待问题

    需要使用异步加载async : true 否则不会出现等待效果 $.ajax({ url : $('#form').attr("action"), data: $('#form') ...

  8. zend studio汉化

    在help菜单中选择Install New Software,在 work with栏中添加上这样的地址 http://archive.eclipse.org/technology/babel/upd ...

  9. php5 数据类型

    一.PHP主要有一下几种数据类型 String(字符串), Integer(整型), Float(浮点型), Boolean(布尔型), Array(数组), Object(对象), NULL(空值) ...

  10. Login Reference for PhotoSomething

    Android Background Processing with Handlers and AsyncTask and Loaders - Tutorial http://www.vogella. ...