Tuesday, December 16, 2014

Checkout in SourceTree (switch branches)

In the previous post Creating a new Branch in SourceTree we created a new branch “GitCommands”, we now have 2 branches “master” and “GitCommands” and the [Head] is pointing to the “GitCommands” branch, we will switch from this branch to the “master” branch.

1.    Open source Tree.

2.    Before switching the branch, check the branch to with the [head] is pointing, now we are in the GitCommands branch.


3.    Click on the Checkout option from the Toolbar.


4.    In the pop-up, select the master branch and click OK.


5.    The [head] now points to the [master] branch, the files in the local working folder are updated to reflect the files in the [master] branch.



Notice that the file “Git Commands.docs” added to the “Git Commands” is not available in the local Working Folder, this is because when you switch to a different branch, the local working folder is refreshed with the files in that branch.

6.    Only one copy of the working folder is maintained, and the files in the working folder reflects the files in the branch to which the head is pointing, hence before switching from one branch to another make sure that the changes are properly committed.
7.  You can also Checkout to an existing branch by right clicking on the branch and selecting the “checkout” option.



Search Flipkart Products:
Flipkart.com

No comments: