Git

usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>] # 这些是在各种情况下使用的常见Git命令:
These are common Git commands used in various situations: # 启动一个工作区域(另请参阅:git help tutorial)
start a working area (see also: git help tutorial)
# 将存储库克隆到新目录中
clone Clone a repository into a new directory
# 创建一个空的Git存储库或重新初始化现有的存储库
init Create an empty Git repository or reinitialize an existing one # 在当前的变化上工作(另请参阅:git help everyday)
work on the current change (see also: git help everyday)
# 将文件内容添加到索引
add Add file contents to the index
# 移动或重命名文件,目录或符号链接
mv Move or rename a file, a directory, or a symlink
# 将当前HEAD重置为指定状态
reset Reset current HEAD to the specified state
# 从工作树和索引中删除文件
rm Remove files from the working tree and from the index # 检查历史和状态(另请参阅:git help revisions)
examine the history and state (see also: git help revisions)
# 使用二分查找找到引入错误的提交
bisect Use binary search to find the commit that introduced a bug
# 打印符合图案的线条
grep Print lines matching a pattern
# 显示提交日志
log Show commit logs
# 显示各种类型的对象
show Show various types of objects
# 显示工作树的状态
status Show the working tree status # 成长,标记和调整你的共同历史
grow, mark and tweak your common history
# 列出,创建或删除分支
branch List, create, or delete branches
# 切换分支或恢复工作树文件
checkout Switch branches or restore working tree files
# 记录对存储库的更改
commit Record changes to the repository
# 在提交,提交和工作树等之间显示更改
diff Show changes between commits, commit and working tree, etc
# 一起加入两个或更多发展历史
merge Join two or more development histories together
# 重新申请在另一个基本技巧之上提交
rebase Reapply commits on top of another base tip
# 创建,列出,删除或验证使用GPG签名的标签对象
tag Create, list, delete or verify a tag object signed with GPG # 协作(另请参阅:git help workflows)
collaborate (see also: git help workflows)
# 从另一个存储库下载对象和参考
fetch Download objects and refs from another repository
# 从另一个存储库或本地分支中获取并与其集成
pull Fetch from and integrate with another repository or a local branch
# 更新远程引用以及关联的对象
push Update remote refs along with associated objects # 'git help -a'和'git help -g'列出可用的子命令和一些
概念指南。 请参阅'git help <command>'或'git help <concept>'
阅读有关特定的子命令或概念。
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

从命令行创建一个新的仓库

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin http://192.168.0.240:3000/useadmin/Null.git
git push -u origin master

从命令行推送已经创建的仓库

git remote add origin http://192.168.0.240:3000/useadmin/Null.git
git push -u origin master
# 远程代码和本地代码合并
git pull --rebase origin master
git push -u origin master # 强制推送
git push -f git fetch
git merge
上面两句等价于
git pull
.gitignore 文件如何在 window 上创建?
.gitignore. 文件名两边都有一个点即可创建
# 注释
xxx 黑名单
!xxx 白名单 dos 命令行
copy nul .gitignore
如何删除 git add 添加到缓存中文件?

git rm -r -n --cached 文件/文件夹名称  ,预览将要删除的文件

一种是 git rm --cached "文件/文件路径",不删除物理文件,仅将该文件从缓存中删除;

一种是 git rm --f  "文件/文件路径",不仅将该文件从缓存中删除,还会将物理文件删除(不会回收到垃圾桶)。
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400 Failed reading client body
fatal: The remote end hung up unexpectedly
//设置 post 缓冲区大小
git config --global http.postBuffer 1048576000
合并分支
git fetch origin master
git merge origin/master

递归遍历

git clone --recursive https://github.com/caffe2/caffe2.git
git reset xxx --hard
git reflog
git reset old_xxx--hard
# 更新子模块
git submodule init
git submodule update

Git 命令行帮助的更多相关文章

  1. Git命令行(转用于学习和记录)

    Git命令行介绍和使用说明(持续更新) 参见:<Git 中文简体教程> 一. 命令“git”或者“git help”查询常用命令 [add]: “git add”——不但是用来添加不在版本 ...

  2. windows下使用TortoiseGit代替Git命令行操作

    windows下使用TortoiseGit代替Git命令行操作 大家在使用svn的时候,都非常喜欢使用小乌龟,也就是TortoiseSVN:那么git也有小乌龟版本,即TortoiseGit. 1.安 ...

  3. git命令行工作的正确姿势

    git命令行创建并提交新分支到mater分支的常规步骤 git branch new_branch git status 查看修改的文件 git add changed_files git commi ...

  4. 【重要】使用Git命令行上传到GitHub上

    [本人GitHub账号:] 用户名:chenhongshuang 密码:shuangshuang6300 邮箱:2452420371@qq.com 进入GitHub账号后 1·新建项目文件名称例dem ...

  5. git 命令行

    在使用 git 命令行之前需要下载安装软件官方网站:https://git-scm.com/window 或者 mac 等其它版本自行下载 使用方法一:安装后在项目文件夹中右键菜单会有个 Git Ba ...

  6. git命令行工作环境配置【转】

    转自:http://www.cocoachina.com/ios/20171115/21163.html 本文为CocoaChina网友whf5566投稿 前言 笔者一直使用git的图形化工具sour ...

  7. git 命令行下浏览器tig使用记录

    git 命令行下浏览器tig使用记录 tig 是一款优化 git 命令行的工具,使 git 命令行更加的便捷人性化 .如果用习惯了,会上瘾. 以下是一些使用记录: 安装成功后,在 Repo 文件夹下, ...

  8. Git的基本使用方法和安装&心得体会(使用git命令行)

    这是补发的,使用命令行操作的. (1)选择本地repository的路径 找到后点鼠标右键,选择git bash here. (2) clone到本地 在命令行输入 git clone ADDRESS ...

  9. 每日一条 git 命令行:git clone https://xxxxx.git -b 12.0 --depth 1

    每日一条 git 命令行:git clone https://xxxxx.git -b 12.0 --depth 1 -b 12.0:分支 12.0 --depth 1:depth 克隆深度,1 为最 ...

  10. 如何通过Git命令行把代码提交到github上

    1.http://www.cnblogs.com/leesf456/p/5169765.html   参考博客 背景:最近入手了mac,看见mac上的大神都是在用git命令行推代码,我很羡慕有木有,好 ...

随机推荐

  1. 请求大神,C#如何截取字符串中指定字符之间的部分 按指定字符串分割 一分为二 c# 去除字符串中的某个已知字符

    string stra = "abcdefghijk";string strtempa = "c";string strtempb = "j" ...

  2. 有关IM即时通讯原理

    在网上搜索了一些资料,谈谈自己对IM即时通讯的理解 IM全称为Instant Messaging,即时通讯,如qq那种的. 现在有两个用户UserA, UserB, 俩人是一个IM通讯软件的好友,Us ...

  3. springboot学习(八) 使用jpa访问数据库

    1.添加maven依赖 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connecto ...

  4. 如何修改两个PHP版本,php-v和phpinfo两个不同的版本

    先查找php.ini find / -name php.ini得出两个ini/usr/local/php/etc/php.ini/etc/php.ini php -i | grep php.ini查看 ...

  5. INSERT 失败,因为下列 SET 选项的设置不正确: 'ARITHABORT'

    当你在SQL Server上试图更新一个索引视图引用的表时,你可能回收到如下有错误 INSERT 失败,因为下列 SET 选项的设置不正确: 'ARITHABORT' 你必须在TSQL前Set ARI ...

  6. 使用Crypto++库编译出错 解决办法

    错误信息: >------ 已启动生成: 项目: testCrypto++, 配置: Debug Win32 ------ >正在编译... >main.cpp >正在链接.. ...

  7. OpenAPI初体验

    问题的一开始源于客户和服务部门抱怨我的REST API文档写得不好,然后又了解到 django rest framework 利用 coreapi 能自动生成文档,再就是看到 swagger.io 上 ...

  8. MYSQL分区表功能测试简析

    1.查看Mysql版本是否支持分区  SHOW VARIABLES LIKE '%partition%';   +-------------------+-------+ | Variable_nam ...

  9. Java8 stream学习

    Java8初体验(二)Stream语法详解 Java 8 flatMap示例 第一个Stream Demo IDEA里面写Stream有个坑 虽然java文件中没错,但是但编译的时候还是报错了, In ...

  10. Centos 7 启动错误:XFS_WANT_CORRUPTED_GOTO 修复

    参考源 如果出现以下报错 [sda] Assuming drive cache: write through Internal error xfs XFS_WANT_CORRUPTED_GOTO at ...