Reputation: 119
I have 3 branches
As per the general branching strategy, all the development activities (check-in/check-out, etc) were carried out in the release branch and release ready code is merged into develop branch as well as to the master branch.
My expectation: Assume I have around 500 commits overall in the release branch. I have a requirement that during the final merge of release ready code to develop branch, develop branch should have all the commits with the entire commit history. i.e. 500 commits, while merge to master should not have all the history (commits) that had happened in the release branch.
It should be more of like, a diff of the first commit and last commit in the branch and not all the intermediate commits. (Master branch should not have 500 commits)
Is it possible to achieve this, and if so how?
Upvotes: 0
Views: 100
Reputation: 1227
You could create a branch off of the develop branch perhaps called develop_merge. Squash the commits on that branch, and merge it into master. The original branch still has all the history.
Upvotes: 0
Reputation: 4061
Squashing that many number of commits is going to take a long time. What you can do is merge with no fast-forward.
You can follow this strategy:
Move to develop and run
git merge release
Then move to master and run
git merge --no-ff develop
This will create a merge commit in master which will effectively be equivalent of the 500 commits.
This strategy has the advantage that it does not mess with your git history and commits won't be 'lost' whereas squashing will completely modify your history, and IMHO I don't think modifying 500 commits worth of history is a good idea
Upvotes: 1
Reputation: 29032
It sounds like you want to squash your commits.
Squashing commits is useful when you have several commits, and you want to "squash" them down into one commit.
Upvotes: 2