由于版本的不同,列出常用几个方法:

  1. git help
  2. git help <command 命令>
    如:git help clean 
    1. NAME
    2. git-clean - Remove untracked files from the working tree
    3.  
    4. SYNOPSIS
    5. git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
    6.  
    7. DESCRIPTION
    8. Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.
    9.  
    10. Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example,
    11. be useful to remove all build products.
    12.  
    13. If any optional <path>... arguments are given, only those paths are affected.
    14.  
    15. OPTIONS
    16. -d
    17. Remove untracked directories in addition to untracked files. If an untracked directory is managed by a different Git repository, it is
    18. not removed by default. Use -f option twice if you really want to remove such a directory.
    19.  
    20. -f, --force
    21. If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or directories unless
    22. given -f, -n or -i. Git will refuse to delete directories with .git sub directory or file unless a second -f is given.
    23.  
    24. -i, --interactive
    25. Show what would be done and clean files interactively. See "Interactive mode" for details.
    26.  
    27. -n, --dry-run
    28. Don't actually remove anything, just show what would be done.
    29.  
    30. -q, --quiet
  3. git help -a && git help -g
    -  git help 命令行 git help <concept>概念(git help -g :常见的Git指南)
    1. 'git help -a''git help -g'列出了可用的子命令和一些概念指南。
    2. 请参阅“ git help <命令>”或“ git help <概念>”以了解特定的子命令或概念。
  4. usage
    1. git [--version] [--help] [-C <path>] [-c <name>=<value>]
    2. [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
    3. [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
    4. [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
    5. <command> [<args>]
  • git config --global credential.helper store记住密码
  • git config user.name xxx配置帐号
  • git config user.email xxx配置邮箱
  • git pull合并
  • git push提交
  • git add .添加
  • git merge --abort恢复
  • git reset merge合并重置
  • git commit -m “xx”提交本地
  • git checkout origin xxx切换分支
  • git branch 查看当前分支
  • git  diff  
    可以查看当前没有add 的内容修改(不在缓冲区的文件变化
  • git diff --cached
    查看已经add但没有commit 的改动(在缓冲区的文件变化)
  • git diff HEAD
    是git  diff   &&  git diff --cached 两条命令的合并
  • git tag -d v1.2.1
    删除指定tags
  • git tag v2.0.6
    创建 tags (基于commit ,请先commit 然后创建)
  • git push origin --tags 
    提交tags
  • git tag -a v0.9 9ff91da
    为已经提交的代码打上tag,下面命令使用到
    1. git log --oneline --decorate --graph

    的乱码(注意一般是日志的第一行也就是最新一次提交的编码)

  • git remote update origin --prune  Git更新远程分支列表
  • 仓库备份:
    1. git clone --mirror <ssh> (git@git.coding.net:yjwb/magento2-mc.git)  

    备份还原:

    1. git clone <ssh:name库名称.git> (magento2-mc.git) 

      

    备份更新:

    1. git --git-dir=/<目录>/<ssh:name 库名称.git>(magento2-mc.git remote update

     

  • 克隆祼仓库:
    1. git clone --bare <ssh> (git@git.coding.net:yjwb/magento2-mc.git)  
  • git reset --hard 还原上次
  • git reset --hard HEAD 还原指定commit
  • git reflog 查看commit历史
  • git reset HEAD .   撤销本地所有add操作
  • git reset HEAD -name 撤销add操作的某个文件或目录:
  • git clean -d -fx 清除本地没有被add的内容
  • 更新 git 子版本库管理:git submodule update;
  • 添加 git 子版本库管理; 
    1、git submodule add 子树GIT地址 目录/+项目名 ;
    2,项目会自动生成 .gitmodules 文件;

常用 git 基础命令的更多相关文章

  1. 常用git的命令

    常用git的命令 详解git fetch与git pull的区别 Git放弃本地所有修改,强制更新: git fetch --all git reset --hard origin/master 说明 ...

  2. Linux最常用的基础命令

    Linux最常用的基础命令个人总结 计算机基础知识: 32bit和64bit系统的区别.系统运行机制 32bit=内存的最大寻址空间是2**32,也就是说最大只能使用4GB的内存64bit=内存的最大 ...

  3. Linux最常用的基础命令 下篇

    Linux最常用的基础命令个人总结 shell脚本 脚本就是:写一堆指令存成一个文本,用于完成一些小任务 a="123" linux中定义一个变量 echo $a echo $b ...

  4. Linux最常用的基础命令 上篇

    Linux最常用的基础命令个人总结 计算机基础知识 32bit和64bit系统的区别.系统运行机制 1989年python 诞生 C语言是编译型的语言,不太支持跨平台 Django 江购 32bit= ...

  5. 学习 git基础命令

    缘起 年后到了新公司,由于个人意愿到了一个海外的项目组,除了自己从Java技术栈转了C#技术栈外,很多技术都是第一次使用,学习压力不小啊. 自己也就先从常用的技术开始学起,比如C#,AngularJS ...

  6. git基础命令详解

    一些必须要知道的概念 git的三个工作区域:工作目录.暂存区.git仓库. 工作目录:其实就是本地文件磁盘上的文件或目录: 暂存区:是一个文件,保存了下次提交的文件列表信息,一般在git仓库目录中: ...

  7. 测试常用——linux 基础命令

    测试常用 的 linux 基础命令 1,查看服务器日志vi 查看文件(查找关键字:exception/exception  :  从上往下找,按n查找下一个关键字,按shift+n查找上一个关键字?e ...

  8. 13类100个常用Linux基础命令

    玩过Linux的人都会知道,Linux中的命令的确是非常多,但是玩过Linux的人也从来不会因为Linux的命令如此之多而烦恼,因为我们只需要掌握我们最常用的命令就可以了.然而每个人玩Linux的目的 ...

  9. Git基础命令的使用——详细教程2

    Git安装默认完成后,在左面点击鼠标右键,鼠标右键菜单中会多出来两个选项: a)  Git GUI Here <—>  图型界面模式 b) Git Bash Here <—> ...

随机推荐

  1. stl stack用法

    栈后进先出 #include<iostream> #include<algorithm> #include<cstdio> #include<stack> ...

  2. TortoiseGit push免输密码

    (ฅ>ω<*ฅ) 噫又好了~ TortoiseGit push免输密码的方法 – 晨旭的博客~https://www.chenxublog.com/2016/03/04/tortoiseg ...

  3. MySQL根据某个字段查询重复的数据

    select count(*) '个数',mobile '手机号',`name` '用户名' from users group by mobile having(count(*) > 1); = ...

  4. async并发处理

  5. PropertyChangeSupport 监听器模式的应用

    PropertyChangeSupport 类实现的监听器功能 ,它是java jdk自带的一个类,用于监听某个对象属性的改变来触发相应信息,具体看代码介绍 import java.beans.Pro ...

  6. 逻辑斯特回归tensorflow实现

    calss #!/usr/bin/python2.7 #coding:utf-8 from __future__ import print_function import tensorflow as ...

  7. day 7-21 pymysql模块

    一.安装的两种方法 第一种: #安装 pip3 install pymysql 第二种: 二.链接,执行sql,关闭(游标) import pymysql user = input("use ...

  8. Hbase数据结构模型

  9. bootstrap.css.map 404

    删除bootstrap.css的最后一行即可: /*# sourceMappingURL=bootstrap.css.map */ English: from bootstrap-theme.css  ...

  10. fastclick的介绍和使用

    移动端点击延迟事件 1. 移动端浏览器在派发点击事件的时候,通常会出现300ms左右的延迟 2. 原因: 移动端的双击会缩放导致click判断延迟 解决方式 1. 禁用缩放 `<meta nam ...