SlideShare a Scribd company logo
kartzontech
For Fun And Productivity
Karthik Sirasanagandla
kartzontech
Why Git?
kartzontech
Speed
kartzontech
Space
Compactness
kartzontech
Mozilla repo.
12 GB in SVN
Mozilla repo.
420 MB in Git
DistributedVCS
kartzontech
SVN Git
Resilience
kartzontech
Branching
kartzontech
Time, Space..
and fun!!..
Git Server
kartzontech
*Best place to look for to set up git server is http://git-scm.com/book/en/Git-on-the-Server
FREE Hosting Services
kartzontech
kartzontech
Any cons?
And what's the way out?
kartzontech
• Git Workflow is different
• Be ready to UN-LEARN
• Un-sophisticated UI clients
• Git CLI is cool and friendly. Use It!
• Git is not a server by itself.
• That’s unlike SVN, CVS, etc.
• But, that’s okay - really!
kartzontech
Theory
WhatYou MUST Know!
kartzontech
Nearly everything is local
Browse logs
Compare Diff
Local Commits
Local Branches
kartzontech
Snapshots Not Differences
SVN
Git
kartzontech
The
Git Object Model
kartzontech
• 40-digit alphanumeric “object name”
• look like 70a114563ec375ff9ecf335fdc4ac27027a454b4
• SHA 1 hash of the object contents
• SHA 1 is a cryptographic hash function
• SHA 1 helps determine object uniqueness
SHA - The Foundation
kartzontech
• Blob
• file contents
• chunk of binary data
• doesn’t have any attributes
• .. not even file name
• renaming file doesn’t change this object
• its location independent (in directory tree)
• Want to see blob contents?
git show <sha_of_blob>
4 Object Types - The Blob
kartzontech
• Tree
• represents contents of a (sub-)directory
• has pointers to blobs and other (sub-)trees
• Want to see Tree contents?
git [show | ls-tree] <sha_of_tree>
4 Object Types - The Tree
kartzontech
• Commit
• links physical state of tree w/
• a description of how we got there (link to parent) and
• why (the commit message)
• Want to not just see but examine your Commit?
git log --pretty=raw
git show -s --pretty=raw <sha_of_commit>
4 Object Types - The Commit
kartzontech
Visualizing
Git Object Model
Need a Demo?
kartzontech
• Tag
• A way to mark your commit as ‘special’
4 Object Types - Tag
Learn in your leisure..
kartzontech
Practice
WhatYou SHOULD Do!
kartzontech
• Copy EXISTING repo.
$ git clone <url_of_remote_repo>
• Create NEW repo
$ mkdir <new_proj_name>
$ cd <new_proj_name>
$ git init
• Check current state of your repo
$ git status
Kick-startYour Work
kartzontech
Persist to your local repo
$ git add [filename | foldername]
$ git commit -m <my_message>
Modify And Commit
kartzontech
• Rollback change BEFORE staging
$ git checkout <file_name>
• Rollback change AFTER staging
$ git reset HEAD <file_name>
$ git checkout <file_name>
Modify And Rollback
kartzontech
View (Un-)Stanged Changes
kartzontech
• Delete a file in repo
$ rm <file_name>
$ git rm <file_name>
$ git commit -m <commit_message>
Remove it from my repo!
kartzontech
Hasty Dev, I am..
Instead of adding log files to .gitignore,
I hurriedly added them to index (staging area).
$ git add -A .
$ git status
# On branch my_pet_feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#	

 new file: errors.log
#	

 new file: out.log
Now.. what do I do?
QUIZ
(Shit that happens..)
kartzontech
Don’t you worry!
Simply “remove the files from index”
$ git rm --cached *.log
$ git status
# On branch my_pet_feature
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# errors.log
# out.log
kartzontech
kartzontech
I confess!
I not only added but did a local commit as well
$ git add -A .
$ git commit -m “bad commit”
QUIZ
(Shittier things happen as well)
kartzontech
No worries!..You are SAFE!!!
$ git reset --soft HEAD^
$ git status
# On branch my_pet_feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#	

 modified: abc.txt
#	

 new file: errors.log
#	

 new file: out.log
$ git rm --cached *.log
$ git status
# On branch my_pet_feature
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# errors.log
# out.log
Alternatively:
$ git reset HEAD^
$ git status
# On branch my_pet_feature
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# errors.log
# out.log
kartzontech
kartzontech
git reset??
kartzontech
kartzontech
The Routine
1. Show me latest commits
git log
2. Show me the last 2 commits
git log -2
3. Show me the patch introduced with each commit
git log -p
4. Show me just the commit messages
git log --pretty=oneline
git log --oneline
kartzontech
The Fun Stuff
1. Show me the commits for last 2 weeks
git log --since=2.weeks
2. Show me the commits before 3 months
git log --before=3.months
3. Show me the commits authored by ‘karthik’ only
git log --author=karthik
4. Show me just the commit where the commiter is ‘karthik’
git log --committer=karthik
kartzontech
QUIZ: Do Try It At Home :)
1. Show me commits made during the first two days of this week
git log _______________________
2. Show me the commits made since the last half hour
git log _______________________
3. Show me the commits authored by ‘karthik’ for the last 10 days
git log _______________________
4. Show me just the commits where the commiter is ‘karthik’ and author is ‘ganesh’
git log _______________________
5. I’ve a commit (with sha a1fix) to fix a high priority bug in Production. I need to merge
these changes in other developmental branches as well. What is the efficient way to do
it?
6. I’ve made some really bad local commits in my feature branch. Can I undo it?
Git Server
kartzontech
git init --bare new_repo_name.git
Client 1:
git remote add origin <url>
git push origin master
git clone <url>
Client 2:
kartzontech
Resources and Recommendations
1. Pro Git by Scott Chacon
2. http://git-scm.com/book (FREE online version of Pro Git)
3. http://git-scm.com/docs
4. http://try.github.io (Got 15 minutes and want to learn Git?)
5. Git in the Trenches by Peter Savage (http://cbx33.github.io/gitt/)
6. https://git.wiki.kernel.org/index.php/GitSvnComparsion
7. http://blog.jessitron.com/
kartzontech
I would really appreciate your feedback...
Please do feel free to drop a note at SpeakerRate
(http://speakerrate.com/talks/25891-git-for-fun-and-productivity)

More Related Content

PPT
Git Cards - Keynote Format
ODP
The Fundamentals of Git
PPT
Git Cards - Powerpoint Format
PDF
Introduction to Git for Artists
PPT
Learn Git Basics
PPTX
Version control system & how to use git
KEY
Git Basics at Rails Underground
PDF
Git Workshop
Git Cards - Keynote Format
The Fundamentals of Git
Git Cards - Powerpoint Format
Introduction to Git for Artists
Learn Git Basics
Version control system & how to use git
Git Basics at Rails Underground
Git Workshop

What's hot (20)

PDF
Git: basic to advanced
PDF
Version Control with Git for Beginners
PDF
Pengenalan Git
PDF
My Notes from https://www.codeschool.com/courses/git-real
PPTX
Git like a pro EDD18 - Full edition
PDF
PDF
Introducción a git y GitHub
DOCX
Git github
PDF
Advanced Git
PDF
Git - Get Ready To Use It
PPTX
Git for beginner
PDF
GIT - GOOD PRACTICES
PPTX
Git tutorial undoing changes
PPTX
Git-ing out of your git messes
PPTX
Gitting out of trouble
PDF
Introduction to Git Version Control System
PPTX
PDF
Git real slides
PDF
Git presentation
PDF
Presentacion git
Git: basic to advanced
Version Control with Git for Beginners
Pengenalan Git
My Notes from https://www.codeschool.com/courses/git-real
Git like a pro EDD18 - Full edition
Introducción a git y GitHub
Git github
Advanced Git
Git - Get Ready To Use It
Git for beginner
GIT - GOOD PRACTICES
Git tutorial undoing changes
Git-ing out of your git messes
Gitting out of trouble
Introduction to Git Version Control System
Git real slides
Git presentation
Presentacion git
Ad

Viewers also liked (6)

PDF
Git: Beyond the Basics
PPT
Marketing Planning&Strategy
PDF
How we use Bitbucket to build Bitbucket
PDF
Learn about Git - Git Tutorial
PPTX
Using Git and BitBucket
PDF
Git 101 Presentation
Git: Beyond the Basics
Marketing Planning&Strategy
How we use Bitbucket to build Bitbucket
Learn about Git - Git Tutorial
Using Git and BitBucket
Git 101 Presentation
Ad

Similar to Git for-fun-and-productivity (20)

KEY
Working with Git
PDF
How to Really Get Git
KEY
Git Tech Talk
PDF
Git Started With Git
PDF
Wokshop de Git
PPTX
Learning Basic GIT Cmd
PPTX
PDF
GIT_In_90_Minutes
PPTX
Introduction To Git Workshop
PDF
Pro git - grasping it conceptually
ODP
How to use git without rage
PDF
Loading...git
PPTX
Git in 10 minutes
PDF
Git the Docs: A fun, hands-on introduction to version control
PDF
Getting some Git
PDF
Git in a nutshell
PDF
Git and github 101
PDF
GIT Basics
Working with Git
How to Really Get Git
Git Tech Talk
Git Started With Git
Wokshop de Git
Learning Basic GIT Cmd
GIT_In_90_Minutes
Introduction To Git Workshop
Pro git - grasping it conceptually
How to use git without rage
Loading...git
Git in 10 minutes
Git the Docs: A fun, hands-on introduction to version control
Getting some Git
Git in a nutshell
Git and github 101
GIT Basics

More from Karthik Sirasanagandla (9)

PPTX
Snaplogic Academy Launch - Chennai
PDF
When agile-becomes-fragile
PDF
PDF
When Agile becomes fragile
PDF
Agile Testing Anti-Patterns and Rescue Strategies (Version2)
PDF
Agile Test Automation Anti-patterns and Rescue Strategies
PPT
Why I hated the daily stand-up and how I started enjoying it?
PPTX
Why I hated the daily stand-up and how I started enjoying it?
PPTX
Deciphering the Ruby Object Model
Snaplogic Academy Launch - Chennai
When agile-becomes-fragile
When Agile becomes fragile
Agile Testing Anti-Patterns and Rescue Strategies (Version2)
Agile Test Automation Anti-patterns and Rescue Strategies
Why I hated the daily stand-up and how I started enjoying it?
Why I hated the daily stand-up and how I started enjoying it?
Deciphering the Ruby Object Model

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Hybrid model detection and classification of lung cancer
PPTX
A Presentation on Touch Screen Technology
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mushroom cultivation and it's methods.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
Tartificialntelligence_presentation.pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A Presentation on Artificial Intelligence
Web App vs Mobile App What Should You Build First.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
NewMind AI Weekly Chronicles - August'25-Week II
Digital-Transformation-Roadmap-for-Companies.pptx
DP Operators-handbook-extract for the Mautical Institute
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Hybrid model detection and classification of lung cancer
A Presentation on Touch Screen Technology
Zenith AI: Advanced Artificial Intelligence
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Approach and Philosophy of On baking technology
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Encapsulation_ Review paper, used for researhc scholars
Mushroom cultivation and it's methods.pdf
1 - Historical Antecedents, Social Consideration.pdf
cloud_computing_Infrastucture_as_cloud_p
Tartificialntelligence_presentation.pptx
Hindi spoken digit analysis for native and non-native speakers
gpt5_lecture_notes_comprehensive_20250812015547.pdf

Git for-fun-and-productivity

  • 1. kartzontech For Fun And Productivity Karthik Sirasanagandla
  • 5. Space Compactness kartzontech Mozilla repo. 12 GB in SVN Mozilla repo. 420 MB in Git
  • 9. Git Server kartzontech *Best place to look for to set up git server is http://git-scm.com/book/en/Git-on-the-Server
  • 12. kartzontech • Git Workflow is different • Be ready to UN-LEARN • Un-sophisticated UI clients • Git CLI is cool and friendly. Use It! • Git is not a server by itself. • That’s unlike SVN, CVS, etc. • But, that’s okay - really!
  • 14. kartzontech Nearly everything is local Browse logs Compare Diff Local Commits Local Branches
  • 17. kartzontech • 40-digit alphanumeric “object name” • look like 70a114563ec375ff9ecf335fdc4ac27027a454b4 • SHA 1 hash of the object contents • SHA 1 is a cryptographic hash function • SHA 1 helps determine object uniqueness SHA - The Foundation
  • 18. kartzontech • Blob • file contents • chunk of binary data • doesn’t have any attributes • .. not even file name • renaming file doesn’t change this object • its location independent (in directory tree) • Want to see blob contents? git show <sha_of_blob> 4 Object Types - The Blob
  • 19. kartzontech • Tree • represents contents of a (sub-)directory • has pointers to blobs and other (sub-)trees • Want to see Tree contents? git [show | ls-tree] <sha_of_tree> 4 Object Types - The Tree
  • 20. kartzontech • Commit • links physical state of tree w/ • a description of how we got there (link to parent) and • why (the commit message) • Want to not just see but examine your Commit? git log --pretty=raw git show -s --pretty=raw <sha_of_commit> 4 Object Types - The Commit
  • 22. kartzontech • Tag • A way to mark your commit as ‘special’ 4 Object Types - Tag Learn in your leisure..
  • 24. kartzontech • Copy EXISTING repo. $ git clone <url_of_remote_repo> • Create NEW repo $ mkdir <new_proj_name> $ cd <new_proj_name> $ git init • Check current state of your repo $ git status Kick-startYour Work
  • 25. kartzontech Persist to your local repo $ git add [filename | foldername] $ git commit -m <my_message> Modify And Commit
  • 26. kartzontech • Rollback change BEFORE staging $ git checkout <file_name> • Rollback change AFTER staging $ git reset HEAD <file_name> $ git checkout <file_name> Modify And Rollback
  • 28. kartzontech • Delete a file in repo $ rm <file_name> $ git rm <file_name> $ git commit -m <commit_message> Remove it from my repo!
  • 29. kartzontech Hasty Dev, I am.. Instead of adding log files to .gitignore, I hurriedly added them to index (staging area). $ git add -A . $ git status # On branch my_pet_feature # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # new file: errors.log # new file: out.log Now.. what do I do? QUIZ (Shit that happens..)
  • 30. kartzontech Don’t you worry! Simply “remove the files from index” $ git rm --cached *.log $ git status # On branch my_pet_feature # Untracked files: # (use "git add <file>..." to include in what will be committed) # errors.log # out.log
  • 32. kartzontech I confess! I not only added but did a local commit as well $ git add -A . $ git commit -m “bad commit” QUIZ (Shittier things happen as well)
  • 33. kartzontech No worries!..You are SAFE!!! $ git reset --soft HEAD^ $ git status # On branch my_pet_feature # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # modified: abc.txt # new file: errors.log # new file: out.log $ git rm --cached *.log $ git status # On branch my_pet_feature # Untracked files: # (use "git add <file>..." to include in what will be committed) # errors.log # out.log Alternatively: $ git reset HEAD^ $ git status # On branch my_pet_feature # Untracked files: # (use "git add <file>..." to include in what will be committed) # errors.log # out.log
  • 37. kartzontech The Routine 1. Show me latest commits git log 2. Show me the last 2 commits git log -2 3. Show me the patch introduced with each commit git log -p 4. Show me just the commit messages git log --pretty=oneline git log --oneline
  • 38. kartzontech The Fun Stuff 1. Show me the commits for last 2 weeks git log --since=2.weeks 2. Show me the commits before 3 months git log --before=3.months 3. Show me the commits authored by ‘karthik’ only git log --author=karthik 4. Show me just the commit where the commiter is ‘karthik’ git log --committer=karthik
  • 39. kartzontech QUIZ: Do Try It At Home :) 1. Show me commits made during the first two days of this week git log _______________________ 2. Show me the commits made since the last half hour git log _______________________ 3. Show me the commits authored by ‘karthik’ for the last 10 days git log _______________________ 4. Show me just the commits where the commiter is ‘karthik’ and author is ‘ganesh’ git log _______________________ 5. I’ve a commit (with sha a1fix) to fix a high priority bug in Production. I need to merge these changes in other developmental branches as well. What is the efficient way to do it? 6. I’ve made some really bad local commits in my feature branch. Can I undo it?
  • 40. Git Server kartzontech git init --bare new_repo_name.git Client 1: git remote add origin <url> git push origin master git clone <url> Client 2:
  • 41. kartzontech Resources and Recommendations 1. Pro Git by Scott Chacon 2. http://git-scm.com/book (FREE online version of Pro Git) 3. http://git-scm.com/docs 4. http://try.github.io (Got 15 minutes and want to learn Git?) 5. Git in the Trenches by Peter Savage (http://cbx33.github.io/gitt/) 6. https://git.wiki.kernel.org/index.php/GitSvnComparsion 7. http://blog.jessitron.com/
  • 42. kartzontech I would really appreciate your feedback... Please do feel free to drop a note at SpeakerRate (http://speakerrate.com/talks/25891-git-for-fun-and-productivity)