Git Product home page Git Product logo

gitapplypatch's Introduction

GitApplyPatch

介绍

Use shell scripts to select existing patches in the project to modify the package name to generate new files and patches(使用shell脚本可选择在项目中现有的补丁进行修改包名生成新文件并应有补丁)

应用场景

最近的项目都是基于标板开发修改包名后起的分支, 在各个分支编写新的代码逻辑, 标板同步维护, 因为包名(文件夹根目录结构)不一致进行同步拉取的时候就会文件夹和类冲突, git会基于标板目录结构在新分支创建新的文件夹和类, 当类修改的比较细碎的时候就失去git文件比对能力。于是使用git补丁同时因为出错的底层原因是包名不一致所以修改补丁文件不一致的包名, 应用补丁之后可以完美使用git进行比对文件差异, 注: git补丁对二进制文件需要做特殊处理!

使用说明 (脚本模式同样可以用于其他用途, 必须find name xxx.txt 循环想要替换的文本)

暂定目录结构分为 /shell (脚本文件) & /diff (补丁文件)

  1. 使用./shell/selectPatchMode.sh 进行diff文件的扫描,如果提示没有权限可以考虑在目录中使用 chmod u+x *.sh

  2. 在selectPatchMode.sh中会调用sedPkgName.sh对指定文件要替换的文字进行替换并生成新文件(也可以不生成新文件设置备份名,将老文件备份)

  3. 上述操作结束后会调用applyGitPatch.sh 进行git应用补丁逻辑,要注意应用补丁需要cd 到 项目的根目录,脚本调用样例中提供两种方式选择

    a. 将/shell & /diff 整体复制到项目根目录 在应用补丁时候 cd ../ 到根目录即可 b. /shell & /diff 目录与项目目录毫无关联,则需要使用 cd 到项目根目录

  4. 注意使用git应用补丁需要使用git apply --reject强制应用根据生成后的.rej文件进行修改后调用applyGitPatch.sh中后续注释的代码

  5. 第四条主要看大家需求不想像我一样强制执行后根据rej修改也阔以

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

gitapplypatch's People

Contributors

githubwebb avatar

Stargazers

aozima avatar  avatar luao avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.