Merging changes between two branches
- Consider the following DAG
- We have create a new branch poc_1.
- Done some commits, the master branch didn’t change
- Now when we merge, it would be enough if the master starts pointing towards the latest commit of poc_1 branch.
- This is called as Fast Forward
- To merge the changes, switch to the branch you want to merge changes to (destination) and then execute command
git merge <source-branch>
git checkout master
git merge poc_1
* We can skip fast forwarding git merge <source-branch> --no-ff
- Consider the following DAG
- Git history
- Now we want changes done in poc_1 branch onto master
- When merging the changes, automatic merges by git will fail when there are conflicting situations which are referred as merge-conflicts
- Fix the changes
- This way of merging is referred as three way merge
-
Consider the following DAG
- After create the POC_1 from master branch, an important commit that needs to be part of POC_1 is committed to master.
- DAG