Distributed (Decentralized)
version control system
Each repository independent and has complete version history
Offline is the normal case
Each clone is a backup
most commands local
commit, branch, merge, history
Git has three main states that your files can reside in: modified, staged, and committed:
How Git stores its data :
Git doesn’t store data as a series of changesets or differences, but instead as a series of snapshots.
Git stores a commit object that contains a pointer to the snapshot of the content you staged.
When you make a commit :
A Brief example :
Creating a new commit :
$ git add README test.rb LICENSE
$ git commit -m 'Initial commit'
Creating two new commits :
If you make some changes and commit again, the next commit stores a pointer to the commit that came immediately before it.
Where is the master branch :
As you start making commits, you’re given a master branch that points to the last commit you made.
Creating a new branch :
$ git branch testing
How does Git know what branch you’re currently on? It keeps a special pointer called HEAD.
Switching Branches :
$ git checkout testing
This moves HEAD to point to the testing branch :
Adding a new commit on testing Branch :
$ vim test.rb
$ git commit -a -m 'made a change'
Adding a new commit on master Branch :
$ git checkout master
$ vim test.rb
$ git commit -a -m 'made other changes'
Use Case:
"Create a wrapper implementation to Transformer"
Hint: Use Git to do a colaborite work