git-guide

git – Version control system (VCS)

git Workflow – 3 trees – From the working directory files are added to the index that are then committed to the HEAD.

1.  working directory: actual files 
2.  index : staging are
3.  HEAD : points to last commit

Basic commands

## To create repo 
git init  

## To Check out/clone repo
git clone <username>@<host>:/path/of/repo


## add and commit changes
## To add single file
git add <filename>  

## To add all changed/new files
git add .

## To add commit
git commit -am "Tell of the changes made since last commit"

## Adding local repo to remote server
git remote add origin <URL-of-.git>

## pushing changes
git push origin master

## after the first push you can use:
git push


## pull updates from repo
git pull origin master

## replace local changes
git checkout -- <filename> # changes already added to index and new files will be kept

## To drop all local changes and commits
git fetch origin
git reset --hard origin/master


## to show changes
git show
git diff

Leave a comment

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax