当前位置: 首页 > news >正文

常用git 指令

记录一些本人最常用的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 <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 fetch --tags
git tag
git checkout 2021.4.2
git submodule update --init --recursive

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

克隆分支:例如,

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
```

相关文章:

  • 常用的anaconda(conda)命令
  • pcl_viewer的使用与viewer窗口编程
  • OpenVINO+Yolov5+Windows10的CPU部署
  • PCD(点云数据)文件格式
  • Labelme在windows下的编译与vscode开发执行
  • Tools_vcpkg包管理工具在VS2019项目开发中的使用
  • Windows通过winscp登陆Ubuntu18.04
  • Ubuntu18.04安装RTL8125/RTL8168等网卡驱动程序
  • Ubuntu如何卸载cuda driver
  • Ubuntu20.04安装Cuda driver + toolkit + cudnn
  • ROS安装时:找不到有效的OpenPGP数据
  • ROS报错:-- Could NOT find PY_em (missing: PY_EM)
  • SLAM算法r3live试运行
  • VINS-MONO:integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
  • Ubuntu如何查看eigen版本
  • [译] React v16.8: 含有Hooks的版本
  • Angular6错误 Service: No provider for Renderer2
  • Apache的80端口被占用以及访问时报错403
  • CAP理论的例子讲解
  • conda常用的命令
  • CSS选择器——伪元素选择器之处理父元素高度及外边距溢出
  • FineReport中如何实现自动滚屏效果
  • Java 多线程编程之:notify 和 wait 用法
  • Java的Interrupt与线程中断
  • Java多态
  • MaxCompute访问TableStore(OTS) 数据
  • PHP那些事儿
  • 初识 beanstalkd
  • 大数据与云计算学习:数据分析(二)
  • 给新手的新浪微博 SDK 集成教程【一】
  • 海量大数据大屏分析展示一步到位:DataWorks数据服务+MaxCompute Lightning对接DataV最佳实践...
  • 记一次用 NodeJs 实现模拟登录的思路
  • 浏览器缓存机制分析
  • 判断客户端类型,Android,iOS,PC
  • 前端每日实战:70# 视频演示如何用纯 CSS 创作一只徘徊的果冻怪兽
  • 腾讯视频格式如何转换成mp4 将下载的qlv文件转换成mp4的方法
  • gunicorn工作原理
  • Java性能优化之JVM GC(垃圾回收机制)
  • 通过调用文摘列表API获取文摘
  • ​LeetCode解法汇总1410. HTML 实体解析器
  • ​草莓熊python turtle绘图代码(玫瑰花版)附源代码
  • #13 yum、编译安装与sed命令的使用
  • #HarmonyOS:基础语法
  • #LLM入门|Prompt#2.3_对查询任务进行分类|意图分析_Classification
  • #stm32整理(一)flash读写
  • (1)(1.13) SiK无线电高级配置(五)
  • (Bean工厂的后处理器入门)学习Spring的第七天
  • (C#)一个最简单的链表类
  • (第二周)效能测试
  • (五)大数据实战——使用模板虚拟机实现hadoop集群虚拟机克隆及网络相关配置
  • (转)VC++中ondraw在什么时候调用的
  • (转)程序员疫苗:代码注入
  • (转载)深入super,看Python如何解决钻石继承难题
  • .NET 依赖注入和配置系统
  • .NET开发人员必知的八个网站