git command: first add other people's patch and add your own modification to make a completed patch

Someone else made a patch in version 1, and the version becomes version 2 at this time. I first added his patch to my code, and then modified the code myself, and released version 3. This is version 1. People need to apply the patch of version 3, so there is a process of adding.

添加完别人的patch,自己修改完之后做成一个patch的一般流程:
先查看当前log:git log /git log -p
添加别人的patch作为自己的:git apply +patch
查看当前版本:git diff
查看当前修改状态:git status
add到缓存区:git add +文件
查看是否到了缓存区:git status
提交本地修改:git commit
查看log日志:git log
查看当前缓存状态:git status
查看自己提交的版本:git log
自己修改本地文件
打印修改日志:git log -p
查看版本信息:git diff
查看缓存区信息:git status
add自己的修改:git add +文件
查看是否添加成功:git status
向上一个版本添加修改提交到本地:git commit --amend
查看当前log信息确保自己提交成功:git log -p
提交成功diff就不会存在自己的修改
先查看自己版本的commit编号:git log
然后用show命令可以查看patch或者直接打出patch:
git show +commit版本号
git show +commit版本号 > patch输出路径和patch名字

Guess you like

Origin blog.csdn.net/weixin_44440669/article/details/120155171