13 Apr 2016

git - simple guide

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.

6 comments:

  1. I was read this blog and it is such a help to me. Thank you for sharing this kind of valuable information.
    https://www.bharattaxi.com

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Now you can close your apps effortlessly on our Android ICS devices simply with a swipe of your finger. Just go to the 'Recent Apps' button to see the applications which you are currently using. Tap the icon of the app you want to close and swipe the icon off the screen and your app will be closed instantly. Easy isn't it?
    For more information visit our website:
    Yah Kaise Techhnology

    ReplyDelete
  5. Thank you for the useful content :)

    Please visit our website:
    Application In Hindi

    ReplyDelete