ICode9

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

常用git 指令

2022-01-13 12:02:13  阅读:141  来源: 互联网

标签:常用 git help repository -- 指令 push commit


记录一些本人最常用的git指令,没有别的意义

git命令的帮助文档在这里,

Git - Referenceicon-default.png?t=LBL2https://git-scm.com/docs指令很多,解释也很全,每个人根据自己的情况,可能常用的相对就非常少了。

这里有些cheat sheet非常有用,

https://training.github.com/downloads/github-git-cheat-sheet.pdf


 

git --help会输出一些最常用的指令,包括下面的信息

D:\OpenCV455>git --help
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>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]

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
   restore   Restore working tree files
   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
   diff      Show changes between commits, commit and working tree, etc
   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
   commit    Record changes to the repository
   merge     Join two or more development histories together
   rebase    Reapply commits on top of another base tip
   reset     Reset current HEAD to the specified state
   switch    Switch branches
   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.
See 'git help git' for an overview of the system.

获取分支版本,更新submodule(安装Openvino 2021.4.2)

git tag
git checkout 2021.4.2
git submodule update --init --recursive

注意:git checkout和git switch功能非常相近啊。

创建分支并添加文件,push到github

Quick setup — if you’ve done this kind of thing before
or    
https://github.com/SpaceView/dataset_conversion_statistics.git
Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line
echo "# dataset_conversion_statistics" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/SpaceView/dataset_conversion_statistics.git
git push -u origin main

…or push an existing repository from the command line
git remote add origin https://github.com/SpaceView/dataset_conversion_statistics.git
git branch -M main
git push -u origin main

…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.


```
git add --all
git status
git commit -m "first commit"
git push -u origin main -f
```

标签:常用,git,help,repository,--,指令,push,commit
来源: https://blog.csdn.net/tanmx219/article/details/122470648

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

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

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

ICode9版权所有