Information Technology Reference
In-Depth Information
CHAPTER 3
Creating Local Repositories with
Linear History
In this chapter you will learn how to create your own repositories, and how to use them
in your daily work. This includes
• Initialization of a new repository with $ git init
• Storingsnapshotsasrevisionswith $ git add -A and $ git commit
-m "..."
• Checking the status of the repository with $ git status -s -b
You'll learn how to start a new project from scratch as well as how to import existing
files.
Three recipes will focus on restoring the working directory to snapshots stored in re-
visions. After learning these recipes you should be able to reset the working directory of
any repository—such as jQuery—to an arbitrary revision, such as the very first revision
in the repository, and then return the working directory to its latest state.
I give special attention to situations that may cause problems. Two recipes describe
precisely how and when you can lose uncommitted or committed modifications. This
knowledge should build your confidence. If you adhere to some simple rules, you will
never lose what you store in your git repository.
In chapter 2 , we characterized the repository as either non-bare or bare. This charac-
terization was based on the presence of a working directory. Here we will introduce an-
other classification: clean or dirty . This classification applies only to non-bare reposit-
ories. A repository is clean when its working directory contents are identical to the
Search WWH ::




Custom Search