总结的提交流程---使用merger
$ git checkout -b featureB origin/master
# (change implementation)
$ git commit
# (origin/master changed)
$ git push myfork featureB
# (failed)
$ git checkout -b featureBv2 origin/master
$ git merge --no-ff --squash featureB # 或者使用git merge --no-ff --no-commit featureB
$ git mergetool
# (change implementation)
$ git commit
$ git push myfork featureBv2
============
merge参数解释
--ff(默认的选项)
When the merge resolves as a fast-forward, only update the branch pointer, without creating a merge commit. This is the default behavior.
--no-ff
Create a merge commit even when the merge resolves as a fast-forward. This is the default behaviour when merging an annotated (and possibly signed) tag.
--no-squash(默认的选项)
--squash
With --no-squash perform the merge and commit the result. This option can be used to override --squash.
Produce the working tree and index state as if a real merge happened (except for the merge information),
but do not actually make a commit, move the HEAD, or 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).
--commit(默认的选项)
--no-commit
Perform the merge and commit the result. This option can be used to override --no-commit.
With --no-commit perform the merge but pretend the merge failed and do not autocommit,
to give the user a chance to inspect and further tweak the merge result before committing.
适合自己的Git工作流
最新推荐文章于 2025-07-29 15:01:53 发布