Information Technology Reference
In-Depth Information
$ cd my/important/project
Initialize a new repository:
$ git init
And create the revision containing all the files:
$ git add -A
$ git commit -m "Initial commit"
Of course, you can use the alias:
$ git snapshot Initial commit
The repository contains a single revision that stores the current state of all the files.
Then, you can proceed with your work, storing all modifications with
$ git snap-
shot
or
$ git add
and
$ git commit
commands.
How It Works
Git's init command can be executed in any directory that doesn't contain a
.git
sub-
directory. You can run
$ git init
in a directory that already contains a project con-
sisting of many files and subdirectories. After the repository is initialized, you can im-
port all the files with two commands
$ git add -A
and
$ git commit -m
"Initial commit"
. You can use
$ git snapshot Initial commit
as
well.
3-10. Losing uncommitted changes
Problem
You want to check what happens to your modifications if you forget to commit changes
and reset the working directory.