Information Technology Reference
In-Depth Information
• The working directory
• The staging area
• And your current branch (i.e. the revision pointed by HEAD)
Each of them defines a snapshot of the files in your project. You can modify the
snapshot stored in the working directory using filesystem commands, such as $ rm , $
cp , $ echo foo > bar , and so forth. The snapshot stored in the staging area is
modified with git commands, such as $ git add , $ git rm , $ gim mv , and so
on. Finally, the snapshot stored in the revision pointed by HEAD can be modified with
the $ git commit command.
Using these three snapshots you can interpret the two lettered state codes returned
by $ git status -sb as:
• The first letter of the code compares the HEAD snapshot and the staging
area:
• The space denotes that the file stored in the HEAD snapshot and in
the staging area are identical
• Any other character denotes that the file stored in the HEAD snap-
shot is different than the file in the staging area
• The second letter of the code compares the staging area and the working
directory
• The space denotes that the file stored in the staging area and the file
stored in the working directory are identical
• Any other character denotes that the file stored the staging area dif-
fers from the file stored in the working directory
This chapter also clarified the concept of authorship and the way git handles dates.
Every commit stores four different attributes: Author , Commit , AuthorDate , and
CommitDate. Author and Commit preserve the identity of the person who au-
thored the code, introduced in this commit ( Author attribute), and the person who in-
troduced the commit in the projects history ( Commit attribute). As you know Author
is set when you execute the $ git commit command (without the --amend para-
meter). When you modify the commit using $ git commit --amend or $ git
cherry-pick , $ git rebase , then git changes only the username of the commit-
Search WWH ::




Custom Search