惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
S
SegmentFault 最新的问题
D
Docker
博客园 - 司徒正美
雷峰网
雷峰网
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - Franky
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
MongoDB | Blog
MongoDB | Blog

ACCB

1Panel第三方应用商店 VS Code 插件推荐 JavaScript 数组方法速查 Linux 命令行技巧 你好,欢迎
Git 常用命令备忘录
lbb · 2025-01-12 · via ACCB

整理了日常开发中最常用的 Git 命令:

基础操作

git init # 初始化仓库

git clone <url> # 克隆仓库

git status # 查看状态

git add . # 添加所有文件到暂存区

git commit -m "message" # 提交更改

git push # 推送到远程

git pull # 拉取远程更新

分支操作

git branch # 查看本地分支

git branch -r # 查看远程分支

git checkout -b <branch> # 创建并切换分支

git checkout <branch> # 切换分支

git merge <branch> # 合并分支

git branch -d <branch> # 删除分支

日志和历史

git log --oneline # 简洁日志

git log --graph # 图形化日志

git show <commit> # 查看提交详情

git diff # 查看变更

撤销操作

git checkout -- <file> # 撤销工作区修改

git reset HEAD <file> # 取消暂存

git reset --hard HEAD^ # 回退到上一版本

记住这些命令,日常开发效率翻倍!