search

Home  >  Q&A  >  body text

git 合并dev 到master 问题

当我在 3 合并到master 时, 不想要1 的提交,怎么办 ???

高洛峰高洛峰2842 days ago609

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-02 09:24:08

    Without committing 1, directly save the changes temporarily, which is equivalent to pulling another branch, then switching to master to merge the branch, and then deleting the temporary save, which is equivalent to deleting another branch, thus ensuring that develop is clean

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:24:08

    In fact, your question itself is a bit problematic. There is a commit before 1 in the dev branch (the difference compared to master). You said you don’t want 1, but do you want the one before 1?

    If you only want 3 and don’t want the first one, then cherrypick 3; if you want the first one of 3 and 1, you can also cherrypick these two separately and skip 1; in a similar situation, if there are many things you want in the middle (or unwanted), you can also rebase interactively before merging.

    In fact, the operating methods of git are very diverse. I can think of three or four ways to solve your problem, so I’d better take some time to learn it carefully, and I won’t ask this kind of question in the future, because I think this There is no optimal solution to this problem, it depends on the specific situation.

    reply
    0
  • Cancelreply