I am learning to use git. It seems that when git branches are merged, for example, the dev branch is merged into the master branch. The current version of master is m1. If there are three new versions of d1, d2, and d3 on the dev branch, merge them. At that time, all three versions of d1, d2, and d3 will be added to the master version.
Can I just merge the final version of development into master?
What I can think of now is that after git merge dev, git reset --soft in the master branch to the m1 version, and then commit to the new version.
Is there a more direct method or instruction to only merge the final version into master when merging?
Or should I git reset --soft the original version of the dev branch in the dev branch before merging, commit the new version, and then merge?
Please tell me how to operate it in actual work.
cherry-pick
You can pull and load content from other branches instead of merging commits.However, it is not recommended to use this. Because this will lose the meaning of using version control.
git cherry-pick <start-commit-id>..<end-commit-id>
git cherry-pick can merge certain commits from different branches