Git合并单个文件和[y,n,q,a,d,/,K,j,J,g,e,?]

Git合并单个文件和[y,n,q,a,d,/,K,j,J,g,e,?]

前言

今天想要合并两个分支的同一个文件,查了网上一些资料,将A分支的a文件合并到B分支的a文件上。可以通过以下方式合并

git checkout B
git checkout --patch A a

先切换到B分支,将A分支的a文件给与B。
然后碰到了Apply this hunk to index and worktree [y,n,q,a,d,/,K,j,J,g,e,?]?
刚开始我是一个一个y按得,后来觉得太慢也不敢乱按网上查询一下意思,在stackoverflow发现答案

[y,n,q,a,d,/,K,j,J,g,e,?]

y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help

上面这些文字都是输入?打印出来的。

Apply this hunk to index and worktree [y,n,q,a,d,/,K,j,J,g,e,?]??

y - 存储这个hunk
n - 不存储这个hunk
q - 离开,不存储这个hunk和其他hunk
a - 存储这个hunk和这个文件后面的hunk
d - 不存储这个hunk和这个文件后面的hunk
g - 选择一个hunk
/ - 通过正则查找hunk
j - 不确定是否存储这个hunk,看下一个不确定的hunk
J - 不确定是否存储这个hunk,看下一个hunk
k - 不确定是否存储这个hunk,看上一个不确定的hunk
K -不确定是否存储这个hunk,看上一个hunk
s - 把当前的hunk分成更小的hunks
e - 手动编辑当前的hunk
? - 输出帮助信息

合并其他分支单个/多个commit

https://www.cnblogs.com/phpper/p/7609238.html
https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E9%AB%98%E7%BA%A7%E5%90%88%E5%B9%B6

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值