当前位置: 首页 > news >正文

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

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

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

相关文章:

  • Oracle:执行DELETE语句长时间无响应的排查步骤及解决方案
  • 超多目标优化:基于导航变量的多目标粒子群优化算法(NMOPSO)的无人机三维路径规划,MATLAB代码
  • 机器视觉--Halcon的数据结构(数组)
  • STM32单片机开发(6).离散PID公式:位置式PID 增量式PID
  • Unity 3D模型边缘锯齿严重
  • Android 技术栈
  • 跟着李沐老师学习深度学习(十四)
  • Visual Studio更新说明(关注:.NET+AI生产力)
  • 本地部署Qwen2.5-VL-7B-Instruct多模态视觉大模型(Windows篇)
  • docker部署安装Seata服务
  • 小波变换背景预测matlab和python样例
  • 从头再来!社招找工作——算法题复习九:动态规划
  • 在 Mac ARM 架构上使用官方安装包安装 MySQL
  • 大语言模型(LLM)微调技术笔记
  • PH热榜 | 2025-02-23
  • PyEcharts 数据可视化:从入门到实战
  • NoSQL注入攻击如何防范
  • 什么是完全前向保密(PFS)?
  • Redis底层数据结构
  • 【行业解决方案篇五】【DeepSeek智慧城市:交通流量预测系统】
  • 网页设计字号设置代码/宁波seo推广优化
  • php禁止ip访问网站/免费站长统计工具
  • 温州手机建站模板/网络推广软件免费
  • 大连科技网站制作/seo数据是什么意思
  • 视频网站开发问题/b2b网站大全免费推广
  • 计算机ui设计是什么/东莞关键词seo优化