美文网首页
git 命令汇总

git 命令汇总

作者: 赫子丰 | 来源:发表于2018-11-27 16:46 被阅读2次

git 命令汇总

git 命令汇总

常用总结

1. $ git help  查看git所有命令的帮助

2.$ git config --global user.name manager

   $ git config --global user.email manager@gmail.com

* 以上两个命令会将用户信息保存在用户目录下的 .gitconfig 文件中

3.$ git config -l  查看当前所有配置

4.$ git status 查看当前代码库状态

5.$ git add .  将当前文件夹下的所有新建或修改的文件一次性添加到代码库

6.$ git commit -m "添加了main.c"   将修改提交到代码库

提示:*   在此一定要使用 -m 参数指定修改的备注信息

7.$ git log  查看所有版本库日志

    $ git reflog  查看分支引用记录

8.$ git reset --hard HEAD  回到当前版本,放弃所有没有提交的修改

    $ git reset --hard HEAD^  回到上一个版本

    $ git reset --hard HEAD~3 回到之前第3个修订版本

    $ git reset --hard e695b67  回到指定版本号的版本

9.$git diff  查看文件变化

10.$git checkout文件名  撤销对文件做的修改

11.$git echo '文件名' >.gitignore  忽略文件

12.$git rm文件名  删除文件

13.$git branch -r  查看远程分支

14.$git branch -r -d  删除远程分支

15.git merge  来源分支名  在目的分支上合并来源分支(先切到目的分支上)

附$git --help:

usage: git[--version][--help][-C ][-c name=value][--exec-path[=]][--html-path][--man-path][--info-path]

           [-p | --paginate | --no-pager][--no-replace-objects][--bare]  [--git-dir=][--work-tree=][--namespace=][]

These are common Git commands used in various situations:

start a working area(see also: git help tutorial)

   clone      Clone a repository into a new directory

   init      Create an empty Git repository or reinitialize an existing one 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

   reset      Reset current HEAD to the specified state

   rm        Remove files from the working tree and from the index 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

   tag        Create,list,delete or verify a tag object signed with GPG 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' 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.

相关文章

  • git 命令汇总

    git 命令汇总 常用总结 1.$ git help 查看git所有命令的帮助 2.$ git config --...

  • git版本管理

    GIT 版本控制常用命令汇总 git version 查看当前git版本信息 git help 获取全部命令帮助信...

  • Git 常用命令详解

    @[TOC](Git 常用命令详解) 1. Git 常用命令 1.1 常用git 命令图表汇总 1.2 配置个人信...

  • 每日小结2.21

    git常用指令汇总 初始化本地仓库 命令:git init 克隆远程仓库 命令:git clone 远程仓库 添加...

  • git learning

    命令汇总 git init (初始化仓库)git add (将文件添加到仓库)git com...

  • Git的学习使用笔记

    一. 重要的参考资料 git干货系列 二. 常用命令汇总 git初始设置 git config --global ...

  • Git命令汇总

    设置用户名和邮箱 --global表示全局的,也可以不加--global为当前项目设置用户名和邮箱 将当前目录设置...

  • Git 命令汇总

    Author: duqi@kongge.com Date: 2017.02.13 总结自廖雪峰-Git教程 将一个...

  • git命令汇总

    1、git rm —cached readme.txt #删除仓库文件但是不删除本地文件,不加--cached就...

  • git命令汇总

    git branch "新分支名":创建新分支 git checkout "已有分支名":切换分支 git che...

网友评论

      本文标题:git 命令汇总

      本文链接:https://www.haomeiwen.com/subject/tbzwqqtx.html