How does git merge only the last version on the development branch to the master branch?
漂亮男人
漂亮男人 2017-05-02 09:40:30
0
4
571

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.

漂亮男人
漂亮男人

reply all(4)
洪涛
git checkout master
git cherry-pick dev # 拿最后一个版本
git cherry-pick dev~3..dev # 拿最新的3个版本
巴扎黑

cherry-pickYou 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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template