Git常用命令一览表

1.git

命令简述
git查看git命令帮助
git <command> --helpgit help <command>查看git子命令帮助
git --version查看git版本

2.git config

命令简述
git config --global --list查看所有配置
git config --global <key>查看指定配置
git config --global <key> <value>添加或更改指定配置
git config --global --unset <key>删除指定配置
git config --global user.name "<name>"添加或更改用户名配置
git config --global user.email "<email>"添加或更改邮箱地址配置
git config --global init.defaultBranch "main"添加或更改git init命令的默认分支名称配置

3.git clone

命令简述
git clone <remote-url>克隆远程仓库到当前目录
git clone <remote-url> <directory>克隆远程仓库到指定目录

4.git init

命令简述
git init将当前目录初始化为一个本地仓库
git init <directory>将指定目录初始化为一个本地仓库

5.git add

命令简述
git add .添加所有目录(包括子目录)和所有文件到暂存区
git add <file>添加指定文件到暂存区
git add <directory>添加指定目录(包括子目录)到暂存区

6.git commit

命令简述
git commit -m '<msg>'提交暂存区到本地仓库,并附加简短描述信息
git commit -a -m '<msg>'提交工作区(跳过了暂存区)到本地仓库,并附加简短描述信息

7.git status

命令简述
git status查看状态

8.git remote

命令简述
git remote查看所有远程仓库(仅显示<remote-name>)
git remote -v查看所有远程仓库(显示<remote-name>和<remote-url>)
git remote add <remote-name> <remote-url>添加远程仓库,并给远程仓库命名
git remote rename <old-remote-name> <new-remote-name>更改远程仓库的<remote-name>
git remote set-url <remote-name> <new-remote-url>更改远程仓库的<remote-url>
git remote remove <remote-name>删除远程仓库

9.git push

命令简述
git push -u <remote-name> <local-branch-name>[:<remote-branch-name>]将本地仓库指定分支与远程仓库指定分支关联,并推送本地仓库指定分支到远程仓库指定分支
git push推送本地仓库当前分支到关联的远程仓库指定分支

10.git pull

命令简述
git pull拉取关联的远程仓库指定分支到本质仓库当前分支

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/experience/linux/31575.html

(0)
huoxiaoqiang的头像huoxiaoqiang
上一篇 2023年3月1日 23:34
下一篇 2023年3月2日 11:26

相关推荐

  • Windows Server 2019将远程桌面用户限制到单会话

    在桌面左下角搜索框输入gpedit.msc打开组策略,依次进入:计算机配置-管理模板-Windows 组件-远程桌面服务-远程桌面会话主机-连接,将配置项“将远程桌面服务用户限制到单独的远程桌面服务会话”为“已启用” ,可以将同一个用户限制在单会话里面。

    Linux经验 2020年8月30日
    06.8K0
  • Google Chrome浏览器的扩展程序被安装在哪个目录?

    Google Chrome浏览器的扩展程序因不同的操作系统可能会被安装在不同的目录,可通过以下方法查看。 1.在Google Chrome浏览器地址栏中输入chrome://version,然后按Enter回车键。 2.打开上图中”个人资料路径”的路径,该路径下的Extensions目录即默认的…

    Linux经验 2019年12月31日
    010.8K0
  • 电脑IE浏览器主页被劫持无法修改的解决方案

    Ghost系统在我们的日常系统安装中提供了非常的方便,不过方便的同时有一些Ghos系统作者强制地把IE浏览器主页劫持了,病症如下: 1.Internet选项-常规-主页处设置了我们自己喜欢的主页或空白页,重新打开浏览器依然是被劫持的主页。 2.regedit打开注册表,搜索被劫持的主页网址,删除了以后依然被劫持。 3.…

    Linux经验 2020年10月3日
    02.6K0

发表回复

登录后才能评论