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

#工具

相关推荐
Revol_C2 小时前
【Git 操作笔记】第1期--云代码仓库更换服务商,本地如何批量更新对应项目的git地址(持续更新...)
前端·git
猫头虎2 小时前
开源协议区别与限制详解:Fork、改名、再发布是否合法?(MIT、Apache、GPL、BSD、SSPL、BSL)
git·开源·github·apache·开源软件·开源协议·gitcode
Kiri霧12 小时前
Git入门
git
Nejosi_念旧13 小时前
git报错解决:ssh: connect to host github.com port 22: Connection refused
git·ssh·github
你的人类朋友14 小时前
说说git的变基
前端·git·后端
程序设计实验室14 小时前
在Windows上将git与ssh-agent搭配使用,再也不用输入git密码了
windows·git
Clownseven15 小时前
Gitea Webhook教程:实现git push后自动部署更新网站 (CI/CD入门)
git·ci/cd·gitea
兔老大RabbitMQ16 小时前
git pull origin master失败
java·开发语言·git
码农小白-RMS1 天前
cursor-执行git指令(vscode同理)
git
爱喝矿泉水的猛男1 天前
Git Commit 提交信息标准格式
git·commit