速查git命令(大部分常用功能)

创建仓库

git init

git clone <url> [directory]

基本语句

git add file/directory

git add *.java

git status

git diff

git commit

git reset HEAD file

取消缓存内容

git rm <file>

git rm -f <file> 强制删除(+暂存)

git rm --cached <file> 删除缓存

git rm -r * 递归

git mv

重命名

分支管理

git branch

查看分支

git branch branchname

创建分支

git checkout branchname

切换到该分支

git checkout -b branchname

创建并切换

git merge branchname

将分支合并到当前分支

git branch -d

版本管理

git log

  • --oneline :查看历史记录的简洁版本
  • --graph :查看历史中什么时候出现了分支、合并
  • --reverse :逆向显示所有日志
  • --author :查找指定用户的提交日志
  • --since、--before、 --until、--after: 指定帅选日期
  • --no-merges :选项以隐藏合并提交

git tag -a vx.x

git tag -a vx.x d6f7147

远程仓库

git remote add [alias] [url]

git remote

git fetch [url]

git merge test/master

git pull [url]

git push

git remote rm

#工具

相关推荐
kk哥889940 分钟前
Git 远程仓库操作
大数据·git·elasticsearch
郑州光合科技余经理4 小时前
实战:攻克海外版同城生活服务平台开发五大挑战
java·开发语言·javascript·数据库·git·php·生活
CNRio5 小时前
Day 2:Git环境搭建全攻略:WindowsmacOSLinux三平台避坑指南
git
好好研究7 小时前
Git - tag标签和Git图像化界面
git·gitee
无限进步_8 小时前
【C语言&数据结构】有效的括号:栈数据结构的经典应用
c语言·开发语言·数据结构·c++·git·github·visual studio
不光头强9 小时前
git命令速查表
大数据·git·elasticsearch
大猫和小黄9 小时前
Ubuntu环境下GitBlit安装部署与版本库迁移
linux·运维·git·ubuntu·gitblit
野生yumeko9 小时前
wsl使用git
git·ssh·wsl
初学者_xuan10 小时前
Git&GitLab安装gitlab(rocky系统)
git·gitlab
凤凰战士芭比Q10 小时前
DevOps理念、Git(Git常用命令)、Gitlab仓库
git·gitlab·devops