Information Technology Reference
In-Depth Information
$ git init 03-01
creates a new empty directory 03-01 and initializes an empty repository inside.
Without any parameters the $ git init command will initialize a new repository in
the current directory.
When the repository is initialized, you can work on your project: you can create
files and type into their contents. Git is very smart in tracking changes you make in the
working directory. It knows all about the modifications you make. If you doubt this, try
using this command:
$ git status
It returns the exact information about the changes that were introduced in the work-
ing directory. The shortened form of this command is also very useful. It is shown in
Listing 3-2 .
Listing 3-2. The command to answer the question: Is the repository dirty or clean?
$ git status -s
Hint The repository can be characterized as either clean or dirty. When we say that
the repository is clean ; it means that all the files in the working directory are stored in
the latest revision. In this state the command: $ git status -s returns an empty
result. The repository is dirty means when the working directory contains modifica-
tions that are not committed. The command: $ git status -s returns the list of
pending changes.
The command from Listing 3-2 prints the list of modifications in a very compact
form. You can treat it as a quick answer to the question: is the repository clean? If the
output is empty then the repository is clean. Otherwise the repository is dirty and the
output lists the modifications.
At some point you will need to make a decision that the current state of the working
directory should be saved as a new revision. To achieve this use the two commands
shown in Listing 3-3 .
 
 
 
Search WWH ::




Custom Search