速查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

#工具

相关推荐
小蜜蜂爱编程1 小时前
gerrit的部署与配置关联到不同服务器上的git仓库
运维·服务器·git·gerrit
颇有几分姿色3 小时前
Git将本地项目推送到GitLab
git·gitlab
Kent_J_Truman7 小时前
Git个人配置偏好记录以及注意事项
git
小龙报9 小时前
《算法每日一题(1)--- 连续因子》
c语言·开发语言·c++·windows·git·算法·visual studio
今禾10 小时前
Git完全指南(中篇):GitHub团队协作实战
前端·git·github
flow_code1 天前
切换git账户
git
春生野草1 天前
Gituee
git·gitee
222you1 天前
Git推送本地仓库到远程
git
小贾要学习1 天前
如何在Linux操作系统环境下使用git命令提交文件到远程仓库
linux·运维·git
J2虾虾1 天前
WebStorm的项目绑定Git并上传到gitee
git·gitee·webstorm