GIT
the stupid content tracker
Resources: Peep Code and Git-SCM
GIT
“In many ways you can just see git as a filesystem — it’s content-addressable, and it has a notion of
versioning, but ...
GIT
1. Non Linear Development - Cheap and efficient branching
2. Distributed Development - No repository is special
3. Eff...
The GIT Way
1. Snapshots not differences
2. Nearly every operations are local.
3. Ensures Integrity.
4. Undo is always an ...
GIT Setup
1. Setting up the origin
2. Setting up the local
GIT Tracking
GIT Tracking
1. Staging
2. Status
3. Viewing the diff
3.1 Working directory and Stage
3.2 Stage and a Commit
3.3 Working d...
GIT Tracking
1. Commit
2. Undo
2.1 Checkout
2.2 Reset [hard, soft, mixed - default]
2.3 Revert
3. Working with remote
An i...
GIT Tracking
Ignores Files from
1. .gitignore from directories [like IDE Related Folders]
2. $GIT_DIR/info/exclude [Projec...
GIT Tracking (Checkout vs Reset vs Revert)
GIT Objects
1. Blob
2. Tree
3. Commit
4. Tag
*3 in italics are important to understand git
GIT Objects
1. The Git Directory serves as the Git Object Database.
2. Each object is compressed and referenced by SHA-1 v...
GIT Objects
tamil@dv-lp-tamil-s:~/gitdemo$ git init
Initialized empty Git repository in /home/tamil/gitdemo/.git/
tamil@dv...
GIT Objects [blob]
1. Stores Contents of files.
2. No file metadata.
3. Two different files with similar contents are mark...
GIT Objects [tree]
1. List of trees and blobs [similar to ls -l in unix] + Some Header.
2. An entry in tree has mode, type...
GIT Objects [commit]
1. Holds a reference to a tree object.
2. Has author, committer, message and any parent commits that ...
GIT Objects [tag]
1. Refers to one particular commit object.
2. Has object, type, tag, tagger and a message.
3. Mostly the...
GIT Data Model
commit
tree
blob
HEAD
branch
remote tag
GIT Data Model [Demo]
…. Some
Action
Branching and Merging
1. Creating a branch is nothing more than just writing 40 characters to a file.
2. Add Remotes to po...
Merging [Fast Forward]
After Merge:
C0 C1 C3
Test
HEAD
C0 C1 C3
HEAD
Test
C0 C1
C3
HEAD
Test
C4
--no-ff Mode:
Merging [3-Way]
C0 C1 C3
C4
HEAD
Test
C0 C1 C3
C4
Test
C5
HEAD
Base Ours
Theirs
More Complex Merges
More Complex Merge [contd.]
GIT Tagging
1. Lightweight - Just a cheap reference to a commit
2. Annotated - More than a reference
Tags can be published...
GIT Stash
1. Helps switching to a different branch even when working directory isn’t clean.
2. Saves uncommitted changes [...
GIT Patches & Cherry Picks
1. Patches are alternate for merge or pull requests [SVN way].
2. Can Merge specific file from ...
GIT Grep
File Grep:
git grep -e “isStringSet” *.js
Log Grep:
git log --grep=fix --author=tamil.s since=’yesterday’
GIT Log
List By (with stats or patches):
User
Time Limit [before, after, since and until]
Grep
Locate the introductory Com...
GIT Workflows
Centralized Workflow
GIT Workflows
Integration manager
GIT Workflows
Benevolent Dictator
GIT Lab
1. Managing your profile
2. Creating a project
3. Managing Members
4. Code Reviews & Comments
5. Managing Issues +...
Questions
Upcoming SlideShare
Loading in …5
×

GIT Presentation

620 views

Published on

A Presentation on GIT SCM Tool. Covers Basics and Internals of GIT

Few References [Recommended Learning]:
http://git-scm.com/doc
https://github.com/pluralsight/git-internals-pdf/releases

Few Interactive Learning [Will get you going]:
https://try.github.io/levels/1/challenges/1
http://pcottle.github.io/learnGitBranching/

Published in: Technology, Travel
  • Be the first to comment

GIT Presentation

  1. 1. GIT the stupid content tracker Resources: Peep Code and Git-SCM
  2. 2. GIT “In many ways you can just see git as a filesystem — it’s content-addressable, and it has a notion of versioning, but I really really designed it coming at the problem from the viewpoint of a filesystem person (hey, kernels is what I do), and I actually have absolutely zero interest in creating a traditional SCM system.” – Linus GIT as a SCM is an usecase Non-SCM Use Cases of GIT: Peer to Peer Content Distribution Network Distributed Document Oriented Database [like wiki]
  3. 3. GIT 1. Non Linear Development - Cheap and efficient branching 2. Distributed Development - No repository is special 3. Efficiency - Fastness, Size & Network Operations
  4. 4. The GIT Way 1. Snapshots not differences 2. Nearly every operations are local. 3. Ensures Integrity. 4. Undo is always an option. 5. And the three states
  5. 5. GIT Setup 1. Setting up the origin 2. Setting up the local
  6. 6. GIT Tracking
  7. 7. GIT Tracking 1. Staging 2. Status 3. Viewing the diff 3.1 Working directory and Stage 3.2 Stage and a Commit 3.3 Working directory and a Commit 4. Remove 5. Move or Rename 6. Referencing
  8. 8. GIT Tracking 1. Commit 2. Undo 2.1 Checkout 2.2 Reset [hard, soft, mixed - default] 2.3 Revert 3. Working with remote An interactive Demo
  9. 9. GIT Tracking Ignores Files from 1. .gitignore from directories [like IDE Related Folders] 2. $GIT_DIR/info/exclude [Project Specific Setting like logs, binaries] 3. core.excludesfile [Stuffs needn’t be shared among developers]
  10. 10. GIT Tracking (Checkout vs Reset vs Revert)
  11. 11. GIT Objects 1. Blob 2. Tree 3. Commit 4. Tag *3 in italics are important to understand git
  12. 12. GIT Objects 1. The Git Directory serves as the Git Object Database. 2. Each object is compressed and referenced by SHA-1 value of [Header + Content].
  13. 13. GIT Objects tamil@dv-lp-tamil-s:~/gitdemo$ git init Initialized empty Git repository in /home/tamil/gitdemo/.git/ tamil@dv-lp-tamil-s:~/gitdemo$ cd.git/ tamil@dv-lp-tamil-s:~/gitdemo/.git$ ll total 40 drwxr-xr-x 7 tamil tamil 4096 Mar 24 17:25 ./ drwxr-xr-x 3 tamil tamil 4096 Mar 24 17:25 ../ drwxr-xr-x 2 tamil tamil 4096 Mar 24 17:25 branches/ -rw-r--r-- 1 tamil tamil 92 Mar 24 17:25 config -rw-r--r-- 1 tamil tamil 73 Mar 24 17:25 description -rw-r--r-- 1 tamil tamil 23 Mar 24 17:25 HEAD drwxr-xr-x 2 tamil tamil 4096 Mar 24 17:25 hooks/ drwxr-xr-x 2 tamil tamil 4096 Mar 24 17:25 info/ drwxr-xr-x 4 tamil tamil 4096 Mar 24 17:25objects/ drwxr-xr-x 4 tamil tamil 4096 Mar 24 17:25 refs/
  14. 14. GIT Objects [blob] 1. Stores Contents of files. 2. No file metadata. 3. Two different files with similar contents are marked one [even while transfers].
  15. 15. GIT Objects [tree] 1. List of trees and blobs [similar to ls -l in unix] + Some Header. 2. An entry in tree has mode, type, name and sha of file or another tree.
  16. 16. GIT Objects [commit] 1. Holds a reference to a tree object. 2. Has author, committer, message and any parent commits that directly preceded it. 3. History is built from the references to parent commits.
  17. 17. GIT Objects [tag] 1. Refers to one particular commit object. 2. Has object, type, tag, tagger and a message. 3. Mostly the type is commit and object referred is the SHA-1 of commit being tagged.
  18. 18. GIT Data Model commit tree blob HEAD branch remote tag
  19. 19. GIT Data Model [Demo] …. Some Action
  20. 20. Branching and Merging 1. Creating a branch is nothing more than just writing 40 characters to a file. 2. Add Remotes to point to other people copies. Merge Types: Fast Forward [--no-ff] 3-Way Merge Merge Strategies: Resolve Recursive [Default for merging 2 branches] Ours Octopus [Default for merging from more than one branch] Subtree
  21. 21. Merging [Fast Forward] After Merge: C0 C1 C3 Test HEAD C0 C1 C3 HEAD Test C0 C1 C3 HEAD Test C4 --no-ff Mode:
  22. 22. Merging [3-Way] C0 C1 C3 C4 HEAD Test C0 C1 C3 C4 Test C5 HEAD Base Ours Theirs
  23. 23. More Complex Merges
  24. 24. More Complex Merge [contd.]
  25. 25. GIT Tagging 1. Lightweight - Just a cheap reference to a commit 2. Annotated - More than a reference Tags can be published or shared with other developers via push. They aren’t pushed by default. git-describe - Shows the most recent tag that is reachable from a commit
  26. 26. GIT Stash 1. Helps switching to a different branch even when working directory isn’t clean. 2. Saves uncommitted changes [modified tracked files and staged changes] as WIP in master. 3. Can be reapplied, dropped or applied on a new branch.
  27. 27. GIT Patches & Cherry Picks 1. Patches are alternate for merge or pull requests [SVN way]. 2. Can Merge specific file from different branch or a commit using patch mode. 3. Cherry Pick helps in applying specific commit from same or another branch.
  28. 28. GIT Grep File Grep: git grep -e “isStringSet” *.js Log Grep: git log --grep=fix --author=tamil.s since=’yesterday’
  29. 29. GIT Log List By (with stats or patches): User Time Limit [before, after, since and until] Grep Locate the introductory Commit and many more.. Might take an year to explore ;)
  30. 30. GIT Workflows Centralized Workflow
  31. 31. GIT Workflows Integration manager
  32. 32. GIT Workflows Benevolent Dictator
  33. 33. GIT Lab 1. Managing your profile 2. Creating a project 3. Managing Members 4. Code Reviews & Comments 5. Managing Issues + Milestones 6. Cool Commit Messages 7. Merge Requests
  34. 34. Questions

×