GIT

GIT:
  • GIT is called as Distributed version control system.
  • Created by Linus Torvald

Why we need GIT?
Case 1 :When you are developing the project alone
                 You developed one project and its running successfully. After some days you thought of adding some features into that, then again you added that features in to your old project code.
You released multiple version to production like project 1.0, project 1.1, project 1.2, project 1.3 .So you will store all this into one folder. To maintain all this we have a tool called version control.

               Earlier we used centralized storage. So everything stored in the server . If server fails , that all we will not have any code.  Now we will keep code in server (Remote repository) and in your local machine(local repository) . So if your server clash also, no problem. you can get it from you or any other system. This is called Distributed version control.


Case 2: When multiple people are working on the same project,

Earlier people used to work on individually and they will share the code to one person, he will merge all that manually. Definitely lot of mistakes may happen when more team members are working.So we have a repository each one can pull the updated code and merge there changes into that and they can push. So it wont impact. This is also one of the reason we are using GIT

Trunk based development - Multiple branches working simultaneously.
       For Ex : if you are working on branch-5, At the same time if you want to fix the bug for branch -4, Yes it is possible. 

Tools : github, bitbucket, gitlab


comments:

This command used to set the user name and email address to your commits.

git config --global user.name "Vinothkumar"
git config --global user.email "vinothkumarw93@gmail.com"

Initialized empty Git repository
git init

Cloning the source code from the existing URL
git clone <url>


Informing git to take all files snapshot under this current folder. Now this snapshot is stored in the temporary area called staging area (index)
git add .
or
git add filename

Now permenentatly stored this index into git 
git commit -m "comment"

Check how many file has the changes
git status

To view the history of changes
git log

Show the file difference which files are not yet staged
git diff

Show the file difference which files are staged
git diff –staged

Managing branches:

Create New Branch
git branch branchname

List all the branches
git branch  

delete feature branch
git branch -d branchname

swith from one branch into another branch
git checkout new_branchname

create a new branch and switch to to that branch
git checkout -b new_branchname

this will help to send the localbranches commit into remote repository.
git push origin branchname

this will take the updated source from the remote repository
git pull

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab