Git merge flattening

前端 未结 3 1454
遥遥无期
遥遥无期 2020-12-08 00:46

If I am working in multiple branches on a single feature, I use git pull branch1 branch2 branch3 to pull all the changes into my master branch. However, all the

3条回答
  •  孤城傲影
    2020-12-08 01:01

    "git merge --squash" (after "git fetch"; "git pull" is just fetch+merge, pehaps it also allows --squash option) might be what you want.

    From 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).

提交回复
热议问题