- Distributed version-control system for tracking changes in source code during software development.
- Initinal release: 7 April 2005; 14 years ago
- Original Author: Linus Torvalds, Finnish-American
src.: https://hackernoon.com/https-medium-com-zspajich-understanding-git-data-model-95eb16cc99f5
git init
# show .git
# show .git/objects
touch README.md
echo "Hello world" > README.md
touch index.js
echo "const a = 1;" > index.js
git add README.md index.js
# Created pointer (TREE object) for 2 files (TREE objects can be nested)
git commit -m "Initial commit"
# Created COMMIT object that has pointer to it's tree object
- Git generates a 40-character checksum (SHA-1) hash for every object and the first two characters of that checksum are used as directory name and the other 38 as file (object) name.
- BLOB (Binary Large OBject) - collection of binary data stored as a single entity in a database management system.
# Show that the checksum is pointer to commit
git log
# Show the pointer to TREE object
git cat-file commit [COMMIT CHECKSUM]
# Show the pointers to files
git ls-tree [TREE CHECKSUM]
# Show the content of a file
git cat-file blob [FILE CHECKSUM]
src.: https://hackernoon.com/understanding-git-branching-2662f5882f9
# Current branch
git branch
# Show .git/refs
# Show that it contains last commit checksum
git log
cat .git/refs/heads/master
# Show .git/refs contains "feature"
git checkout -b feature
# Pointer to current ref
cat .git/HEAD
# Show that I'm not a liar
git checkout master
cat .git/HEAD
src.: https://hackernoon.com/understanding-git-index-4821a0765cf
# Explain .git/HEAD vs. .git/refs vs. .git/index (BLOB)
# and now!
git status
# You can see your diff
- Introduction to Git - talk by Scott Chacon: https://www.youtube.com/watch?v=xbLVvrb2-fY