Saturday, July 8, 2017

Introduction to GIT and SourceTree



Git is an open source Version Control software to handle from small to very large projects with speed and efficiency. For documentation you can see the "https://git-scm.com/doc" link.



I used "SourceTree" as frontend in my local machine. It's a GUI for GIT and also a free software which you can download from "https://www.sourcetreeapp.com" link. The Graph at the Left give pictorial representation the history of the code. The description shows



The key concepts of GIT are as follows:

Remote Master:
This is main repository where the code is stored.  It has the latest merged code.

Local Master:
A copy of all code from remote master is stored in Local. Every developer has to set this in order to do the development.

Clone:
=> Clone option is to get a local copy from remote repository
=> Sample screenshot shown below





Pull changes from a remote repository (Git)

=> Click on the local branch you want to work or local master to get the latest changes from REMOTE Master.
=> Click on Pull button top.











Commit and push a change (Git)

=> Click on Commit button on top
=> Select to files you want commit
=> Click on Stage option.
=> All the selected files will be moved to Stage


=> Give the comments for Commit and enable "Push changes immediately to -". As shown below.



=> The changes will be saved and pushed to Remote.



Create a branch (Git)

=> Click on Branch button on top
=> Give new branch name as shown below






=> It will be created locally
=> Your changes will be tracked & saved in the newly created branch.





See the link for further details (it also contains creation and push a branch to the remote repository). https://confluence.atlassian.com/get-started-with-sourcetree/commit-and-push-a-change-git-847359114.html





Merge changes from one branch to another (Git)

You can merge the changes from other branches. Please see the link for further details




To setup a repository please see the following link. This explains various scenarios of setting up a repository.