版本管理 git repo

发布时间:2026/5/26 17:09:22

版本管理 git repo 记录Git直接管理Git仓库而Repo管理的是多个Git仓库的组合。摘自一位博主描述gitGit是一个开源的分布式版本控制系统用以有效、高速的处理从很小到非常大的项目版本管理.Repo: Repo是谷歌用Python脚本写的调用git的一个脚本,Repo实现管理多个git库。主要是用来下载、管理Android项目的软件仓库(也就是说Repo是用来管理给Git管理的一个个仓库的).rk3568芯片的一个linux的SDK包$filerepo repo: Python script, ASCII text executablegitadd-fbuildroot/output/rockchip_rk3588/.configgitlog-p./gitshow-p--name-only f0b658gitshow --name-only f0b658gitshow b9923|cat#添加gitstash push-mtmp#查看gitstash list#查看详情gitstash show-pstash{0}#回溯应用gitstash apply stash{0}如果你想要将最近的 3 个提交生成补丁可以执行以下命令gitformat-patch-3这个命令会在当前目录下生成 3 个补丁文件比如0001-commit-message.patch、0002-commit-message.patch等每个文件代表一个提交的补丁。gitrestore--source4b91bf72a1--staged--worktreekernel-5.10/drivers/gpu/drm/bridge/synopsys/Makefilecat.gitignoreEOF .ash_history EOF.gitignore文件已经正确包含了.ash_history但Git仍然显示这个文件被修改了。这是因为.ash_history文件之前已经被Git跟踪了而.gitignore只对未被跟踪的新文件有效对于已经加入版本控制的文件无效。从Git索引中移除这个文件gitrm--cached.ash_history补丁生成与应用生成最近三次提交的补丁生成最近3次提交的补丁gitformat-patch-3HEAD这会生成3个补丁文件例如0001-first-commit.patch 0002-second-commit.patch 0003-third-commit.patch其他常用方式生成从某次提交到最新的补丁# 从某个 commit 之后的所有提交不包含该 commitgitformat-patchcommit-hash# 示例gitformat-patch abc123生成指定范围内的补丁# 两个 commit 之间的补丁不包含第一个包含最后一个gitformat-patchcommit1..commit2# 示例gitformat-patch HEAD~3..HEAD生成多个提交为单个补丁文件# 将所有修改打成1个补丁gitdiffHEAD~3 HEADcombined.patch# 或使用 format-patch 配合 --stdoutgitformat-patch-3HEAD--stdoutall-three.patch生成带序号前缀的补丁# 自定义前缀gitformat-patch-3HEAD --subject-prefixPATCH# 输出到指定目录gitformat-patch-3HEAD-o/path/to/patches/查看将要生成哪些补丁# 预览最近3次提交gitlog-3--oneline应用多个补丁# 按顺序应用所有补丁gitam *.patch# 或指定单个gitam 0001-first-commit.patch最常用的是git format-patch -3 HEAD会为最近3次提交各生成一个独立的补丁文件。

相关新闻