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