Articles → GIT → Merge Command In Git

Merge Command In Git






Purpose





Syntax




  1. Go to the target branch using following syntax
  2. git checkout <target branch>


  3. Use merge command
  4. Git merge <source branch>



Example




BranchOperationAfter merge with other branch
MasterCreate an empty text file 1.txtAn empty text file 1.txt is created in dev.
MasterText added in 1.txtSame text will be added in dev. Branch.
Dev.1. Change in 1.txt 2. Created 2.txt1. Changes of 1.txt will be overridden.
2.2.txt gets created.
DevDelete 1.txtFile gets deleted in master branch as well.



What Will Happen To Untracked And Files In Staging Area?


  1. If there is any untracked file in one branch then it will also appear as untracked file in another branch.
  2. 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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250