ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Git系列:常用命令

2020-10-31 23:33:54  阅读:174  来源: 互联网

标签:git 系列 centos -- merge Git master 常用命令 root


一.背景

作为一名程序员,怎么能不懂Git那些常用命令呢?于是花费一点时间来总结Git命令。关于安装的话,就不讲了。

二.常用命令

1.配置全局的用户名称和用户邮箱

git config --global user.name "用户名" && git config --global user.email "邮箱账号"

git config --list

git config user.name

[root@centos-master ~]# git config --global user.name "robin" && git config --global user.email "code9342@gmail.com"
[root@centos-master ~]# git config --list
user.name=robin
user.email=code9342@gmail.com
[root@centos-master ~]# git config user.name  
robin
[root@centos-master ~]# 

2.查看帮助

git help -a 

git help <command> 

[root@centos-master ~]# git help -a
usage: git [--version] [--help] [-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>]

available git commands in '/usr/libexec/git-core'

  add                       clean                     fast-import               init                      merge-tree                receive-pack              revert                    tar-tree
  add--interactive          clone                     fetch                     init-db                   mergetool                 reflog                    rm                        unpack-file
  am                        column                    fetch-pack                log                       mktag                     relink                    send-pack                 unpack-objects
  annotate                  commit                    filter-branch             lost-found                mktree                    remote                    sh-i18n--envsubst         update-index
  apply                     commit-tree               fmt-merge-msg             ls-files                  mv                        remote-ext                shell                     update-ref
  archive                   config                    for-each-ref              ls-remote                 name-rev                  remote-fd                 shortlog                  update-server-info
  bisect                    count-objects             format-patch              ls-tree                   notes                     remote-ftp                show                      upload-archive
  bisect--helper            credential                fsck                      mailinfo                  pack-objects              remote-ftps               show-branch               upload-pack
  blame                     credential-cache          fsck-objects              mailsplit                 pack-redundant            remote-http               show-index                var
  branch                    credential-cache--daemon  gc                        merge                     pack-refs                 remote-https              show-ref                  verify-pack
  bundle                    credential-store          get-tar-commit-id         merge-base                patch-id                  remote-testpy             stage                     verify-tag
  cat-file                  describe                  grep                      merge-file                peek-remote               repack                    stash                     web--browse
  check-attr                diff                      hash-object               merge-index               prune                     replace                   status                    whatchanged
  check-ignore              diff-files                help                      merge-octopus             prune-packed              repo-config               stripspace                write-tree
  check-ref-format          diff-index                http-backend              merge-one-file            pull                      request-pull              submodule
  checkout                  diff-tree                 http-fetch                merge-ours                push                      rerere                    submodule--helper
  checkout-index            difftool                  http-push                 merge-recursive           quiltimport               reset                     subtree
  cherry                    difftool--helper          imap-send                 merge-resolve             read-tree                 rev-list                  symbolic-ref
  cherry-pick               fast-export               index-pack                merge-subtree             rebase                    rev-parse                 tag

'git help -a' and 'git help -g' lists available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

3.克隆远程仓库

git -b dev git仓库

4.初始化git

git init

[root@centos-master git]# mkdir my-project
[root@centos-master git]# cd my-project/
[root@centos-master my-project]# git init
Initialized empty Git repository in /opt/git/my-project/.git/
[root@centos-master my-project]# ls -a
.  ..  .git
[root@centos-master my-project]# 

暂时不写了!感觉没啥好写的,拿着就能用那种

 

 

标签:git,系列,centos,--,merge,Git,master,常用命令,root
来源: https://www.cnblogs.com/vic-tory/p/13908272.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有