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

相关推荐
大白要努力!1 天前
Android 项目历史提交远程仓库资源过大,如何清理历史提交中无用的大文件
android·git
一点事1 天前
git:已有主分支,创建空分支,管理项目
git
指尖跳动的光1 天前
git 提交报 Updates were rejected because the tip of your current branch is behind
git
痕忆丶1 天前
Git_Rebase_Conflict_Resolution
大数据·git
啃火龙果的兔子1 天前
vscode中的git插件
git·vscode·elasticsearch
小钟不想敲代码1 天前
GitFlow
git·gitflow
云和数据.ChenGuang2 天前
git commit复合指令
大数据·git·elasticsearch
-拟墨画扇-2 天前
Git | 文件提交操作
git·gitee·github·gitcode
CoderJia程序员甲2 天前
GitHub 热榜项目 - 日榜(2025-12-25)
git·ai·开源·llm·github
-拟墨画扇-2 天前
Git | 文件修改操作
大数据·git·gitee·github·gitcode