您当前的位置: 首页 >  git
  • 0浏览

    0关注

    483博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

常用git 指令

高精度计算机视觉 发布时间:2022-01-13 11:57:57 ,浏览量:0

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

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

Git - Referencehttps://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 ] [-c =]
           [--exec-path[=]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=] [--work-tree=] [--namespace=]
           [--super-prefix=] [--config-env==]
            []

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 ' or 'git help '
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.

获取分支版本,更新submodule(安装Openvino 2021.4.2)
git fetch --tags
git tag
git checkout 2021.4.2
git submodule update --init --recursive

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

查看当前tag

git tag --points-at HEAD

克隆分支:例如,

git clone -b noetic-devel https://github.com/ros.git

创建分支并添加文件,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 ```

关注
打赏
1661664439
查看更多评论
立即登录/注册

微信扫码登录

0.0379s