Pages

Monday 30 January 2012

Learning Git - Basic Command

I think most of the programmers or IT geeks know about GitHub.  Created an account at GitHub recently (it's kinda late and have nothing to share yet) and started to learn Git.

Learned basic git command today.

1. Create git repository.
    $ git init (a .git subdirectory is created)

2. View status of files in working directory and staging area.
    $ git status (descriptive output)
    or 
    $ git status -s (short output)

3. Add files to staging area.
    $ git add [file_name] 
    or 
    $git add . (add all files under the directory we give)

4. Snapshot the staged content
    $ git commit (open a text editor to write commit message)
    or
    $ git commit -m "commit message" (write commit message at the same line)

That's all for my learning today. Keep it on.

References:

No comments:

Post a Comment