Git开发常用命令总结

Git开发常用命令总结

克隆仓库

复制代码
git clone --depth 3 -b 17.0 --single-branch https://github.com/odoo/odoo.git odoo17

参数说明:

  • --depth 3 : 只克隆最近提交的3条记录到本地。
  • -b 17.0 --single-branch : 只拉取分支 17.0

拉取仓库

git pull <远程主机名> <远程分支名>:<本地分支名>

复制代码
git pull origin master:master

新建和切换分支

git switch和git checkout

远程库增删改查

复制代码
git remote add <远程库名> <远程库地址>
git remote remove <远程库名>
git remote rename <原远程库名> <新远程库名>
git remote set-url <远程库名> <远程库地址>

# 查看所有远程库信息
git remote -v

git 创建空分支 https://blog.csdn.net/linyichao1314/article/details/136956650

Git 实用技巧2------新建空白分支 | 重命名分支 | 回退到历史 commit https://blog.csdn.net/m0_49270962/article/details/137759940

相关推荐
今日无bug21 小时前
Git 提交:用全栈技术打造智能 Commit Message 生成器
git·全栈
明月_清风1 天前
拒绝盲目 Git:VS Code 神级插件 GitLens 的 9 个进效杀手锏
前端·git
goodspeed3 天前
Git Worktree:多分支并行开发的利器
git·github
雮尘5 天前
让 AI Agent 高效并行开发的命令-git worktree
人工智能·git·agent
南果梨6 天前
OpenClaw 完整教程!从安装到使用(官方脚本版)
前端·git·开源
Selicens7 天前
git批量删除本地多余分支
前端·git·后端
闲云一鹤8 天前
Git LFS 扫盲教程 - 你不会还在用 Git 管理大文件吧?
前端·git·前端工程化
vibecoding日记10 天前
为什么我就想要「线性历史 + Signed Commits」,GitHub 却把我当猴耍 🤬🎙️
git·编程工具
程序员小崔日记11 天前
如何将代码轻松上传到 Gitee?Git 使用全攻略!
git·gitee·上传