GIT : Getting Started

This post is under progress and will be completed in couple of days.
Objective : To let beginner to get started with GIT very quickly and provide a quick reference to experience git users

GIT :
Is a distributed version control system.

How does it work in practice:
1) Keep a central respository remotely a we keep on "https://bitbucket.org/"
2) Each developer keeps a copy of the central repository on their local workstation ( called local repository)
3) Every morning before starting work the developer makes their local repository upto date from remote repository
4) Each developer ideally creates and work on a separate branch.
5) At the end of day we merge all branches to a common branch and push this to remote repository.

Setting up remote repository for free
1) Visit https://bitbucket.org/
2) Create your login account
3) It will show the wizard to create repository

Setting up local repository
A) Set up git in your local workstation
1) Search in google and download git installer
2) Install it

B) Set up local repository
1) Git Repository Setup (first time only)
    a) Cd to directory where you want repository
    -> cd /home/alibaba/nodeproj
    b) clone the repository from bitbucket
     -> git clone https://sheikhali@bitbucket.org/sheikhali/nodetest.git
    c) setup you name and account
    -> git config --global user.name "Sheikh Ali"
    -> git config --global user.email "sheikh.ali.akhtar@gmail.com"

3) cd to repository
    -> cd /home/alibaba/nodeproj/nodetest
4) check branches
    -> git branch -a
5) create a branch in local repository and push to origin
    -> git checkout -b newbranchname
    -> git push origin newbranchname
6) add some file
    -> git add .    ** it will add all files and subfolders file recursively
            ** the same will work for delete as well.
7) to remove some files explicitly
    -> git rm filenametobedeleted
    -> git rm $(git ls-files --deleted) ** this will check for all files deleted from git repository and will remove
8) add folder and files inside
    -> git add html/admin/*
9) commit added files
    -> git commit -a -m "commentgoeshere"
10) push it back to origin
    -> git push origin "branchname"

Comments