Git merge squash repeatedly

后端 未结 5 2137
暗喜
暗喜 2020-12-04 09:23

I\'m trying to have two branches with binary files in git - one \"development\" and one \"stable\". The development branch can have several changes of these files before I w

5条回答
  •  猫巷女王i
    2020-12-04 09:33

    This isn't the right place to use merge --squash. One good place to use it is in a throwaway topic branch, which you're going to merge into your main branch and then get rid of. All the development done in the topic branch is shown as one commit in the main branch. In your situation, you should merge from the development branch normally, and then use git-rebase --interactive to squash the commits you want.

    Is it possible to somehow record the merge, without producing a "merge commit" with two parents?

    If I understand the question correctly, no. Absolutely not.

    Is it possible to tell git to merge only a certain "range" of revisions, like in SVN?

    Yes. git merge [commit hash]

    Or, is it possible to do a normal merge without having to download all refs from the other branch when pulling?

    See answer to previous question.

    Or should I provide a custom merge driver for the files in question, that simply renames "their" version to "our", thereby resolving the conflicts? I'm still afraid that --squash will always try to merge the whole history, up to the common parent, solving only half of my problem.

    No! Just don't use git merge --squash. This isn't the right place to use it!

提交回复
热议问题