Monday, April 8, 2013

Quick intro to git

Here are some quick steps to setup a project under git - Say, you have a project called project at /path/to/project

1. Initialize the git repository
    cd /path/to/project
    git init

   This will create a directory called .git at /path/to/project

2. git add file1 file2 ...
    Add the files that you'd like to be tracked

3. git commit -m "comments for commit"
    This will "commit the changes

After that, you can make changes to the file and then do a "git diff" to see the changes

Unlike other repositories, you need to do "git add" each time

Say, you make changes to file - f1 - to put the changes into the repository, you need to do

git add f1
git commit -m "comment"