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

  1. git help
  2. git help <command 命令>
    如:git help clean 
    NAME
    git-clean - Remove untracked files from the working tree SYNOPSIS
    git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>... DESCRIPTION
    Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example,
    be useful to remove all build products. If any optional <path>... arguments are given, only those paths are affected. OPTIONS
    -d
    Remove untracked directories in addition to untracked files. If an untracked directory is managed by a different Git repository, it is
    not removed by default. Use -f option twice if you really want to remove such a directory. -f, --force
    If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or directories unless
    given -f, -n or -i. Git will refuse to delete directories with .git sub directory or file unless a second -f is given. -i, --interactive
    Show what would be done and clean files interactively. See "Interactive mode" for details. -n, --dry-run
    Don't actually remove anything, just show what would be done. -q, --quiet
  3. git help -a && git help -g
    -  git help 命令行 git help <concept>概念(git help -g :常见的Git指南)
    'git help -a'和'git help -g'列出了可用的子命令和一些概念指南。
    请参阅“ git help <命令>”或“ git help <概念>”以了解特定的子命令或概念。
  4. usage
    git [--version] [--help] [-C <path>] [-c <name>=<value>]
    [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
    [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
    [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
    <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,下面命令使用到
    git log --oneline --decorate --graph

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

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

    备份还原:

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

      

    备份更新:

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

     

  • 克隆祼仓库:
    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. hdu6249 区间动态规划

    题目链接 题意:给出一些区间,求选k个区间能覆盖的最多点的数量 思路:定义dp[i][j]为前i个点取j个区间的最大值.dp[i][j]可以转移到dp[i+1][j+1]和以i+1为起点的区间终点 具 ...

  2. Python学习第十四篇——类初步使用及面向对象思想

    class Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.name = restaurant_name sel ...

  3. GitHub和Git超超超详细使用教程

    GitHub的简单使用第一步 创建GitHub账号1. 打开GitHub官网.2. 点击绿色按钮Sign up for GitHub,填写用户名,邮件地址和密码.注意: 用户名只能包含字母和" ...

  4. python_函数名的应用、闭包、装饰器

    0.动态传参内容补充: 0.1 单纯运行如下函数不会报错. def func1(*args,**kwargs): pass func1() 0.2 *的魔性用法 * 在函数定义的时候,代表聚合. *在 ...

  5. JEECG SSO kisso

    kisso: java 基于 Cookie 的 SSO 中间件 kisso https://gitee.com/baomidou/kisso kisso首页.文档和下载 - 基于 Cookie 的 S ...

  6. day 7-2 multiprocessing开启多进程

    一. multiprocessing模块介绍 python中的多线程无法利用多核优势,如果想要充分地使用多核CPU的资源(os.cpu\_count\(\)查看),在python中大部分情况需要使用多 ...

  7. vs2012密钥

    Microsoft Visual Studio Ultimate 2012 旗舰版 有效注册密钥:YKCW6-BPFPF-BT8C9-7DCTH-QXGWC:KCW6-BPFPF-BT8C9-7DCT ...

  8. 剑指offer(10)

    题目: 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变. 思路: 如果忽略题目中 ...

  9. linux audit审计(8)--开启audit对系统性能的影响

    我们使用测试性能的工具,unixbench,它有一下几项测试项目: Execl Throughput 每秒钟执行 execl 系统调用的次数 Pipe Throughput 一秒钟内一个进程向一个管道 ...

  10. dbexpress连接mysql提示Operation not allowed on a unidirectional dataset

    最近刚接触delphi,在了解到dbExpress连接mysql的时候,出现了一些问题,特记录下 我遇到的问题有两个 1. TDBGrid --DataSet=TDataSource1 TDataSo ...