Articles → GIT → Merge Command In GIT
Merge Command In GIT
Purpose
Syntax
- Go to the target branch using following syntax
git checkout <target branch>
- Use merge command
Git merge <source branch>
Example
| Branch | Operation | After merge with other branch |
|---|
| Master | Create an empty text file 1.txt | An empty text file 1.txt is created in dev. |
| Master | Text added in 1.txt | Same text will be added in dev. Branch. |
| Dev. | 1. Change in 1.txt 2. Created 2.txt | 1. Changes of 1.txt will be overridden. 2.2.txt gets created. |
| Dev | Delete 1.txt | File gets deleted in master branch as well. |
What Will Happen To Untracked And Files In Staging Area?
- If there is any untracked file in one branch then it will also appear as untracked file in another branch.
- If there is any file in the staging area then it will gets copied to another branch once you switch.
| Posted By - | Karan Gupta |
| |
| Posted On - | Friday, August 2, 2019 |