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

#工具

相关推荐
小妖6664 小时前
git branch -a 还有一些已经删除了的分支
git
&Sinnt&20 小时前
Git 版本控制完全指南:从入门到精通
git·后端
Tiny2141 天前
多人协同开发时Git使用命令
git
WebGirl1 天前
代码Revert后再次Merge会丢失的问题
git
小皮侠1 天前
nginx的使用
java·运维·服务器·前端·git·nginx·github
HalukiSan1 天前
如何提交PR
git·gitlab·github
爱莉希雅&&&2 天前
shell编程之awk命令详解
linux·服务器·git
baiyu332 天前
成为git砖家(12): 看懂git合并分支时冲突提示符
git
wu_aceo2 天前
将本地项目提交到Gitee
git·gitee·提交·本地提交·上传git
随便取个六字2 天前
GIT操作 学习
git·学习