gpt4 book ai didi

Git merge 展平

转载 作者:IT王子 更新时间:2023-10-29 00:50:40 29 4
gpt4 key购买 nike

如果我在多个分支中处理单个功能,我会使用 git pull branch1 branch2 branch3 将所有更改 pull 入我的主分支。但是,每个分支的所有提交日志也会被复制。如何将提交日志扁平化为一条消息?

最佳答案

“git merge --squash”(在“git fetch”之后;“git pull”只是 fetch+merge,也许它也允许 --squash 选项)可能是你想要的。

来自 git-merge(1) :

--squash

Produce the working tree and index state as if a real merge happened, but do not actually make a commit or move the HEAD, nor record $GIT_DIR/MERGE_HEAD to cause the next git commit command to create a merge commit. This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).

关于Git merge 展平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/783731/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com