SlideShare a Scribd company logo
1 of 17
Download to read offline
Git Study Notes
@angusli
What’s Git?
• Git is distributed version control system
focused on speed, effectivity and real-world
usability on large projects. Its highlights
include:
– Distributed development
– Strong support for non-linear development
– Efficient handling of large projects
– Cryptographic authentication of history
– Toolkit design
Who is using Git?
• Git
• Linux Kernel
• Perl
• Gnome
• Qt
• Ruby on Rails
• Android
• PostgreSQL
• Wine
• Fedora
• Debian
• X.org
• …. and you?
Study Notes
• Step 0: Environment setting and help
• Step 1: Init project
• Step 2: Change and modify file
• Step 3: Undo your stuff
• Step 4: View log
• Step 5: Tagging
• Step 6: Branching
• Step 7: Work with remotes
• Step 8: Advanced Git
Step 0: Env setting and help
• git config --list
• git config --global user.name
• git config --global user.email
• <ready to go!>
• git help <verb>
Step 1: Init project
• git init
• git add *
• git commit -m "init comment“
• git clone /path/to/.git
Step 2: Change and modify file(1)
from progit.org
Step 2: Change and modify file(2)
from progit.org
Step 2: Change and modify file(3)
• git status
• git add <file>
• git diff
• git diff --cached
• git commit -m "edit commit“
• git commit -a -m "auto commit“
• git mv
Step 3: Undo your stuff
• git revert <commit>
• git commit -m "undo last commit and re-commit" –amend
• git rm <file>
• git rm --cached <file>
• git reset <file>
• git checkout <version> <file>
Step 4: View log
• git log -1
• git log -p
• git log -p -2
• git log --stat
• git log --shortstat
• git log --pretty=oneline
• git log --pretty="%h %cn: %s“
• git log --pretty="%h %cn: %s" --graph
• git log --since/after/until/before=2.weeks/”2010-10-20”
Step 5: Tagging
• git tag
• git tag -l "a*“
• git tag <tag-name>
• git tag -a <tag-name> -m “comment”
• git show <tag-name>
• git tag <rev-hash>
• git push origin <tag-name>
• git push --tags
Step 6: Branching
• git branch
• git branch -v
• git branch <bname>
• git checkout <bname>
• git checkout -b <bname>
• git merge <bname>
• git add <conflict-file>
• git commit
• git branch --merged/--no-merged
• git rebase
• git rebase --continue/skip/abort
Step 7: Work with remotes
• git remote
• git remote -v
• git remote add <origin-name> /path/to/.git
• git remote show <origin-name>
• git pull
• git fetch
• git fetch <origin-name>
• git merge <origin-name>/master
• git remote rename <origin-name> <name-name>
• git remote rm <origin-name>
Step 8: Advanced Git
• Submodules
• Git servers
• Hosted Git
• Distributed Git
• Git internals
Git resources
• http://git-scm.com/
• http://progit.org/
• http://ktown.kde.org/~zrusin/git/git-cheat-sheet-large.png
• http://www.kernel.org/pub/software/scm/git/docs/
• http://www-cs-students.stanford.edu/~blynn/gitmagic/
• http://stackoverflow.com/questions/315911/git-for-
beginners-the-definitive-practical-guide
End

More Related Content

What's hot

Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHubRabiraj Khadka
 
EGit 3.0 and beyond
EGit 3.0 and beyondEGit 3.0 and beyond
EGit 3.0 and beyondmsohn
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone useIkuru Kanuma
 
Git in the Enterprise: How to succeed at DevOps using Git and a monorepo
Git in the Enterprise: How to succeed at DevOps using Git and a monorepoGit in the Enterprise: How to succeed at DevOps using Git and a monorepo
Git in the Enterprise: How to succeed at DevOps using Git and a monorepoGina Bustos
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GITGhadiAlGhosh
 
Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Sunny Sharma
 
Getting Into Git
Getting Into GitGetting Into Git
Getting Into GitRick Umali
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Zyxware Technologies
 
Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010alanburke
 
An introductory guide to GIT
An introductory guide to GITAn introductory guide to GIT
An introductory guide to GITAmith jayasekara
 

What's hot (20)

Git
GitGit
Git
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Open source
Open sourceOpen source
Open source
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHub
 
EGit 3.0 and beyond
EGit 3.0 and beyondEGit 3.0 and beyond
EGit 3.0 and beyond
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
 
Github
GithubGithub
Github
 
Git in the Enterprise: How to succeed at DevOps using Git and a monorepo
Git in the Enterprise: How to succeed at DevOps using Git and a monorepoGit in the Enterprise: How to succeed at DevOps using Git and a monorepo
Git in the Enterprise: How to succeed at DevOps using Git and a monorepo
 
Git-Basics
Git-BasicsGit-Basics
Git-Basics
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
 
Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013
 
Getting Into Git
Getting Into GitGetting Into Git
Getting Into Git
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...
 
Gitmar
GitmarGitmar
Gitmar
 
Hacktoberfest 2021
Hacktoberfest 2021Hacktoberfest 2021
Hacktoberfest 2021
 
Git step by step
Git step by stepGit step by step
Git step by step
 
Git Primer
Git PrimerGit Primer
Git Primer
 
Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010
 
An introductory guide to GIT
An introductory guide to GITAn introductory guide to GIT
An introductory guide to GIT
 

Similar to Git study notes

Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptxgdscuds
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...WSO2
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .HELLOWorld889594
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsGorav Singal
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Ashok Kumar
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
11 git version control
11 git version control11 git version control
11 git version controlWasim Alatrash
 

Similar to Git study notes (20)

Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
Git 基础
Git 基础Git 基础
Git 基础
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
Advanted git
Advanted git Advanted git
Advanted git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
11 git version control
11 git version control11 git version control
11 git version control
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Git study notes

  • 2. What’s Git? • Git is distributed version control system focused on speed, effectivity and real-world usability on large projects. Its highlights include: – Distributed development – Strong support for non-linear development – Efficient handling of large projects – Cryptographic authentication of history – Toolkit design
  • 3. Who is using Git? • Git • Linux Kernel • Perl • Gnome • Qt • Ruby on Rails • Android • PostgreSQL • Wine • Fedora • Debian • X.org • …. and you?
  • 4. Study Notes • Step 0: Environment setting and help • Step 1: Init project • Step 2: Change and modify file • Step 3: Undo your stuff • Step 4: View log • Step 5: Tagging • Step 6: Branching • Step 7: Work with remotes • Step 8: Advanced Git
  • 5. Step 0: Env setting and help • git config --list • git config --global user.name • git config --global user.email • <ready to go!> • git help <verb>
  • 6. Step 1: Init project • git init • git add * • git commit -m "init comment“ • git clone /path/to/.git
  • 7. Step 2: Change and modify file(1) from progit.org
  • 8. Step 2: Change and modify file(2) from progit.org
  • 9. Step 2: Change and modify file(3) • git status • git add <file> • git diff • git diff --cached • git commit -m "edit commit“ • git commit -a -m "auto commit“ • git mv
  • 10. Step 3: Undo your stuff • git revert <commit> • git commit -m "undo last commit and re-commit" –amend • git rm <file> • git rm --cached <file> • git reset <file> • git checkout <version> <file>
  • 11. Step 4: View log • git log -1 • git log -p • git log -p -2 • git log --stat • git log --shortstat • git log --pretty=oneline • git log --pretty="%h %cn: %s“ • git log --pretty="%h %cn: %s" --graph • git log --since/after/until/before=2.weeks/”2010-10-20”
  • 12. Step 5: Tagging • git tag • git tag -l "a*“ • git tag <tag-name> • git tag -a <tag-name> -m “comment” • git show <tag-name> • git tag <rev-hash> • git push origin <tag-name> • git push --tags
  • 13. Step 6: Branching • git branch • git branch -v • git branch <bname> • git checkout <bname> • git checkout -b <bname> • git merge <bname> • git add <conflict-file> • git commit • git branch --merged/--no-merged • git rebase • git rebase --continue/skip/abort
  • 14. Step 7: Work with remotes • git remote • git remote -v • git remote add <origin-name> /path/to/.git • git remote show <origin-name> • git pull • git fetch • git fetch <origin-name> • git merge <origin-name>/master • git remote rename <origin-name> <name-name> • git remote rm <origin-name>
  • 15. Step 8: Advanced Git • Submodules • Git servers • Hosted Git • Distributed Git • Git internals
  • 16. Git resources • http://git-scm.com/ • http://progit.org/ • http://ktown.kde.org/~zrusin/git/git-cheat-sheet-large.png • http://www.kernel.org/pub/software/scm/git/docs/ • http://www-cs-students.stanford.edu/~blynn/gitmagic/ • http://stackoverflow.com/questions/315911/git-for- beginners-the-definitive-practical-guide
  • 17. End