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

#工具

相关推荐
MrLi01043 分钟前
在git中同时配置gitcode和github访问权限
git·github·gitcode
越来越无动于衷3 分钟前
Git 团队协作完全指南:从基础到高级应用
git
小怪兽会微笑9 分钟前
如何上传github(解决git的时候输入正确的账号密码,但提示认证失败)
git·github
Komorebi_999913 小时前
Git常用指令
git·web
一小池勺15 小时前
🚀 Git 如何让文件存在于远程仓库却不被本地追踪?
git·github
五月高高17 小时前
Idea使用git不提示账号密码登录,而是输入token问题解决
git
魏 无羡17 小时前
idea实现git版本回退的常见场景
java·git·intellij-idea
ergevv20 小时前
不同场景下git指令的搭配
git·源代码管理·代码
不了_谢谢21 小时前
项目仓库文件太大怎么清理?如何清理git仓库大文件记录?
git