1. Setup :-
(a) git-osx-installer(b) git-for-windows
(c) git-for-linux
2. Create a new local repository :-
create a new directory, open it and perform a
git init :- to create a new git repository.
3. Checkout a repository :-
Create a working copy of a local repository:
git clone /path/to/repository
For a remote server, use:
git clone username@host:/path/to/repository
4. Add & commit :-
Add one or more files to staging (index):
git add *
Commit changes to head (but not yet to the remote repository):
git commit -m "Commit message"
5. Pushing changes :-
Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute :
git status :- List the files you've changed and those you still need to add or commit:
git pull origin master : - if conflict , resolve conflict and again follow step no 4. then push the code.
git push origin master :- push the code to your remote repository.
6. Branching :-
Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository.
Create a new branch and switch to it: git checkout -b branchname
Switch from one branch to another: git checkout branchname
List all the branches in your repository, and also tell you what branch you're currently in: git branch
Delete the feature branch: git branch -d branchname
Push the branch to your remote repository, so others can use it: git push origin branchname
Push all branches to your remote repository: git push --all origin
Delete a branch on your remote repository: git push origin :branchname
7. Update & merge :-
Fetch and merge changes on the remote server to your working directory: git pull
To merge a different branch into your active branch: git merge branchname
if conflict, resolve conflict and again follow step no 4. then push the code in your remote repository.
Read More !