Branching allows us to create a replica of existing project by diverging it into its own path. Branching commonly used to create new project from existing project when we require working on two projects at a same time that contain same files at the time of branching. For instance, when we release application to production environment, we need to support it while working on additional functionality of the application. As a result there is a need to have two projects in parallel one for doing fixes to released version and another for incorporating new features.
Branching can be done via TFS Source Control or from command line using “tf branch” command line. Branching has a source and a target. Source is the project we are trying to replicate into target project. In order to fully create the branch, we need to commit all the pending changesets. Another important aspect is that all files must be in a non-deleted state before they can be branched out.
Check-Out permission is required for the branching operation.
Merging allows to combines two different branches into one. Once more source branch and target branch are required and changes are incorporated from source branch into target branch.
Merging can be done via TFS Source Control or from the command line using “tf merge” command. Merge detects files that were added or modified inside Source Branch and will add these changes or file into Target branch. If same files on the Target Branch were modified, then Conflict Resolution screen will pop-up with the opportunity to resolve the conflict.
Important to note, if we try to merge items with the identical names, type conflict will occur. Merging does not handle this kind of situations but error messages are being logged.
TFS Source Control keeps all the historical records for mergers that have occurred and we can review those by utilizing “tf merges” command line.
Check-Out permission is required for the merging operation.