GIT
source: jwiegley.github.io/git-from-the-bottom-up/
1.Definition of terms
- Repository
- it is a collection of commits
- it defines HEAD
- it contains a set of branches and tags
- Index
- changes are first registered in the index
- it is a way of confirming changes before doing a commit
- it is also called the staging area
- working trees
- it is any directory on your filesystem which has a repository associated with it
- typically indicated by the presence of a sub-directory within-it, named: git
- it includes all the files and subdirectories in that directory
- Commit
- it is a snapshot of your working tree at some point of time
- it is an archive of what the project`s tree looked like at a past date
- Whether on your machine or someone else`s
- the state of HEAD at the tim your commit is made becomes that commit`s parent
- this is what creates the notion of a `revision history`
- branch
- it is just a name for a commit
- it is also called a reference
- it is a parentage of a commit, which defines its history, and thus the typical notopn of a "branch of development"
- tag
- It is also a name for a commit
- it is similar to a branch
- it always names the same commit (<> branch)
- it can have its own description text
- master
- it is a branch that is called master
- the mainline of development in most repositoriesis done in master
- This is a typical default, but it is not special
- head
- it is used by your repository to define what is currently checked out
- you checkout a branch
- HEAD symbolically refers to that branch
- indicating that the branch name should be updated after the next commit operation
- you checkout a specific commit
- HEAD refers to that commit only
- this is referred to as a detached HEAD
- it occurs if you checkout a tag name
2.workflows
- you create a repository
- git checkout
- you complete your work in the working tree
- you complete the bugs
- you are ready to compile
- git-add
- you add your changes to the index
- your changes and all the other are what you intend to commit
- git commit
- you record the content of the index in the repository
REPOSITORY ->git-checkout->WORKING TREE->git-add->INDEX->git-commit->REPOSITORY
3. Repository
File system:
- Root Directory
- directory A (tree)
- file A: leaf node A (blob)
- data1
- data2
- file B:leaf node B
- file C
- dir B
- dir C
- dir D
- ....
4.Blob
- Create repository
- Which hash id GIT stores my greetings
- everybodu even in diff computer will get the same hash id
- because GIT realize we track the same content
- initialize a new repository and commit the file into it
- Our blob should be in the sys with the hash id as above
- usually six digits: af5626
- or seven af5626k
5.Conclusion
The whole sys is about blob management
Comments
Post a Comment