Getting Started using Git

Get started using Git on a project

Git Basics

git init

cd into the source code

$ git init

Initialized empty Git repository in home/bart/foo/.git/

git add

The git add command adds files to the staging area. This tells git to begin tracking changes in the content of the file.
However, its important to note that you need to also "commit" the files to record the current snapshot the file.
add all of the files to the git staging area, also recursively add files from any sub-directory
$ git add .
or to choose files invidually:
$ git add foo.c bar.c conf/baz.sql

To make things easier, you can create a .gitignore file and add any files that you do not want included in the repository.
You can use wildcard characters to exclude files by pattern.
$ vi .gitignore
*.class
*~
a.out
bin/*
(Create this before you run "git add ."!

Tags:

Add new comment