git 合并多个commit

假如现在要合并b943f045a9af 和 8380ce479010 这两个commit

tiantao@EstBuildSvr1:~/kernel/rebasekernel/kernel$ git log --oneline
b943f045a9af (HEAD) mm/sparse: fix kernel crash with pfn_section_valid check
8380ce479010 mm: fork: fix kernel_stack memcg stats for various stack implementations
726b7bbeafd4 hugetlb_cgroup: fix illegal access to memory

执行tiantao@EstBuildSvr1:~/kernel/kernel$ git rebase -i 726b7bbeafd4 ,注意这里一定要rebase 到要合并的前一个
pick 8380ce479010 mm: fork: fix kernel_stack memcg stats for various stack implementations
pick b943f045a9af mm/sparse: fix kernel crash with pfn_section_valid check

# Rebase 726b7bbeafd4..b943f045a9af onto 726b7bbeafd4 (2 commands)

将第二个pick 改成s,

pick 8380ce479010 mm: fork: fix kernel_stack memcg stats for various stack implementations
s b943f045a9af mm/sparse: fix kernel crash with pfn_section_valid check

# Rebase 726b7bbeafd4..b943f045a9af onto 726b7bbeafd4 (2 commands)
#

就会看到下面的log,将两个commit message 也合并了
# This is a combination of 2 commits.
# This is the 1st commit message:

mm: fork: fix kernel_stack memcg stats for various stack implementations

Depending on CONFIG_VMAP_STACK and the THREAD_SIZE / PAGE_SIZE ratio the
space for task stacks can be allocated using __vmalloc_node_range(),
alloc_pages_node() and kmem_cache_alloc_node().

In the first and the second cases page->mem_cgroup pointer is set, but
in the third it's not: memcg membership of a slab page should be
determined using the memcg_from_slab_page() function, which looks at
page->slab_cache->memcg_params.memcg .  In this case, using
mod_memcg_page_state() (as in account_kernel_stack()) is incorrect:
page->mem_cgroup pointer is NULL even for pages charged to a non-root
memory cgroup.

It can lead to kernel_stack per-memcg counters permanently showing 0 on
some architectures (depending on the configuration).


# This is the commit message #2:

我一般不改commit message,这样容易知道哪连个commit 被合并了,这里为了demo改成this is a test
this is a test
# Please ente

最后结果,可以看到这两个commit 已经被合并成一个,commit log 被改成this is a test
tiantao@EstBuildSvr1:~/kernel/rebasekernel/kernel$ git rebase -i 726b7bbeafd4
[detached HEAD 916cacc54138] this is a test
 Author: Roman Gushchin <guro@fb.com>
 Date: Sat Mar 28 19:17:25 2020 -0700
 4 files changed, 58 insertions(+), 2 deletions(-)
Successfully rebased and updated detached HEAD.
tiantao@EstBuildSvr1:~/kernel/rebasekernel/kernel$ git log --oneline
916cacc54138 (HEAD) this is a test
726b7bbeafd4 hugetlb_cgroup: fix illegal access to memory

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值