I am relatively new to using git.
recently from master we branched +-10 feature branches. lets call them A, B, C, etc.
I want to merge these all together for testing. is it fine if I create a new branch, and merge in my features?
eg
[master] git checkout -b integration
[integration] git merge A
[integration] git merge B
[integration] etc
once all the features have been tested and approved, is it then safe to merge integration
into master, and have the feature branch history maintained in the master log
eg
[integration] git checkout master
[master] git merge integration
[master] git branch -d integration
Thanks
The more the branches and master diverge away from each other the farther away their “common ancestor” commit becomes. When you're done with a branch and it has been merged into master, delete it. A new branch can be made off of the most recent commit on the master branch.
Build your strategy from these three concepts: Use feature branches for all new features and bug fixes. Merge feature branches into the main branch using pull requests. Keep a high quality, up-to-date main branch.
Short answer: yes.
Long answer: yes and, assuming no changes are made to your master branch in the meantime, your merge to master will be a "fast forward" merge so after [master] git merge integration
, the master branch will look like the integration branch prior to the merge.
The "branch history" will appear in the master branch. IMHO it's best not to think of your history as "branch history", rather as "code history".
If you want to record the fact the change came from a merge, use git merge --no-ff
to force the creation of a merge commit even when a fast-forward commit (which keeps history linear when possible) would work.
See also Correct Git workflow for shared feature branch?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With