Git Repo下如何制作一个patch文件

news/2025/2/24 9:20:30

Git Repo下如何制作一个patch文件

  • 1. 源由
  • 2. 步骤
    • 2.1 本地代码差异
    • 2.2 添加修改代码
    • 2.3 添加未跟踪代码
    • 2.4 确认打包文件
    • 2.5 输出打包文件
    • 2.6 自查打包文件
    • 2.7 恢复工作环境
  • 3. 总结

1. 源由

patch分享,更好的差异化比较,减少时间浪费。同时,也可以作为系统集成的差异化补丁,快速实现本地集成。

2. 步骤

2.1 本地代码差异

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Makefile
        modified:   README.md
        modified:   msposd.c
        modified:   osd.c

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        osd.h
        osd/util/subtitle.c
        osd/util/subtitle.h

no changes added to commit (use "git add" and/or "git commit -a")

2.2 添加修改代码

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add Makefile
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add README.md
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add msposd.c
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add osd.

2.3 添加未跟踪代码

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add osd.h
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add osd/util/subtitle.c
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git add osd/util/subtitle.h

2.4 确认打包文件

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git satus
git: 'satus' is not a git command. See 'git --help'.

The most similar command is
        status
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   Makefile
        modified:   README.md
        modified:   msposd.c
        modified:   osd.c
        new file:   osd.h
        new file:   osd/util/subtitle.c
        new file:   osd/util/subtitle.h

2.5 输出打包文件

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git diff --cached > msposd.srt.53.patch

2.6 自查打包文件

Windows系统下,双击Patch文件,非常容易查看的,仔细核对是否是这些改动。

  • msposd.srt.53.patch

在这里插入图片描述

2.7 恢复工作环境

从这里可以看到多了msposd.srt.53.patch打包文件,其他和2.1一样。

daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git restore --staged .
daniel@daniel-nvidia:~/Work/jetson-fpv/module/msposd$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Makefile
        modified:   README.md
        modified:   msposd.c
        modified:   osd.c

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        msposd.srt.53.patch
        osd.h
        osd/util/subtitle.c
        osd/util/subtitle.h

no changes added to commit (use "git add" and/or "git commit -a")

3. 总结

这份分享代码,就是针对最近在折腾的原始视频+OSD文本记录的需求,详见:

  • [Request] OSD info save as sperate files, not in DVR #35
  • add osd/srt support #53

虽然,目前上述需求还有一些问题,但是整体上已经非常接近。只要修正一些小问题,相信不久的将来就能赏心悦目了。


http://www.niftyadmin.cn/n/5864164.html

相关文章

【AI学习笔记】2月10日李飞飞巴黎AI峰会演讲:探索 AI 的历史、现状与未来

【AIGC学习笔记】2月10日李飞飞巴黎AI峰会演讲&#xff1a;探索 AI 的历史、现状与未来 AI 的历史根基与发展历程 生命起源与智能诞生&#xff1a;5 亿年前视觉概念的出现推动了智能的诞生。最初的感知仅仅是被动的体验&#xff0c;只是但随着神经系统的活跃&#xff0c;视觉…

Rust学习~tokio简介

对于 Async Rust&#xff0c;最重要的莫过于底层的异步运行时&#xff0c;它提供了执行器、任务调度、异步 API 等核心服务 使用 Rust 提供的 async/await 特性编写的异步代码要运行起来&#xff0c;就必须依赖于异步运行时 异步运行时 Rust 语言本身只提供了异步编程所需的基…

基于Spring Boot的党员学习交流平台设计与实现(LW+源码+讲解)

专注于大学生项目实战开发,讲解,毕业答疑辅导&#xff0c;欢迎高校老师/同行前辈交流合作✌。 技术范围&#xff1a;SpringBoot、Vue、SSM、HLMT、小程序、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、安卓app、大数据、物联网、机器学习等设计与开发。 主要内容&#xff1a;…

结构化需求分析SA

一、定义与目的 结构化需求分析旨在通过系统化的方法&#xff0c;将复杂的需求进行分类、分解和组织&#xff0c;以便更好地理解和满足用户需求。其主要目的是通过对需求进行结构化处理&#xff0c;明确系统的功能和边界&#xff0c;以便后续的系统设计、开发和测试。 二、基…

Automa 浏览器自动化编排 实现自动化浏览器操作

在日常的浏览器使用过程中&#xff0c;我们常常会遇到一些重复繁琐的任务&#xff0c;比如反复填写网页表单、从网页抓取数据、定时截图等&#xff0c;这些工作不仅耗费时间和精力&#xff0c;还容易出错。今天要给大家介绍的Automa&#xff0c;就是一款专门用来解决这类问题的…

【无标题】oscp备考,oscp系列——Tr0ll1靶场,两种提权方式,ftp匿名登录,ssh爆破,ubuntu内核提权,计划任务

前言 oscp备考&#xff0c;oscp系列——Tr0ll1靶场&#xff0c;两种提权方式&#xff0c;ftp匿名登录&#xff0c;ssh爆破&#xff0c;ubuntu内核提权&#xff0c;计划任务 难度简单 对于低权限shell获取涉及&#xff1a;ftp匿名登录&#xff0c;ssh爆破对于提权&#xff1a;…

Java基础常见的面试题(易错!!)

面试题一&#xff1a;为什么 Java 不支持多继承 Java 不支持多继承主要是为避免 “菱形继承问题”&#xff08;又称 “钻石问题”&#xff09;&#xff0c;即一个子类从多个父类继承到同名方法或属性时&#xff0c;编译器无法确定该调用哪个父类的成员。同时&#xff0c;多继承…

解释 Vue 中的虚拟 DOM,如何通过 Diff 算法最小化真实 DOM 更新次数?

1. 虚拟DOM核心原理&#xff08;附代码示例&#xff09; // 简化的VNode结构示意 class VNode {constructor(tag, data, children) {this.tag tag // 标签名this.data data // 属性/指令等this.children children // 子节点数组} }// 两个新旧虚拟节点树示例 const oldV…