赞
踩
patch作用:修复了基线的一个bug,在未合并代码的时候,同步到各个版本的发布分支,用于解决问题
# 方法一
# git 上传代码到页面后,git数字编号后去掉+.patch刷新页面,复制更改部分,切换到git工作目录粘贴文件为file_name
# 打补丁
git am file_name
# 方法二
# 生成补丁
git diff > commit.patch
# 检查补丁
git apply --check commit.patch
# 应用补丁
git apply commit.patch
方式一 本地修改未commit
希望把修改的内容生成patch,可以如下操作:
git diff > commit.patch
对于已经add但是未commit的修改:
git diff --cached > commit.patch
方式二 本地修改已commit
希望把最近一次的修改生成patch:
# 注意:commitId为倒数第二个提交ID
git diff commitId > commit.patch
# 检查patch是否可以应用
git apply --check commit.patch
# 打单个补丁
git apply commit.patch
# 打多个补丁
git apply ../patch/*.patch
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。