SlideShare a Scribd company logo
Git
What is Git?
Distributed version control system (DVCS)
SVN = Centralized version control system
Mercurial, Bazaar are other DVCS
Initially designed and developed by Linus
Torvalds to manage Linux kernel code base
when BitKeeper revoked free license.
SVN (Centralized VCS) overview
Git (Distributed VCS) overview
Git (Distributed VCS) overview
(cont)
Why Git?
Embraced by all major hosting sites:
Github, Google Code, CodePlex, BitBucket
Used by major projects
Linux kernel, Android, ASP.NET MVC,
Facebook, Eclipse, Twitter Boostrap, ...
• Able to work disconnected (ex. VPN / home)
o (Almost) everything is local, fast
o Log is always available
o Private workspace
 Able to commit whenever, create snapshots,
push when ready (off VPN, done hacking)
 Share when ready, ability to modify previous
commits before sharing
• Local branching, easily switch gears when
customer calls (isolate work units)
 features, bug fixes, proof of concepts, etc
Why Git? - Benefits
General workflow
File status lifecycle
Repository commits
Terms
HEAD
last commit of current branch
HEAD^
parent of HEAD
master
default development branch (trunk)
origin
default upstream repository (name of remote
when git clone was used)
Terms (cont.)
HEAD^ == HEAD~1 # parent of HEAD
HEAD^^^ == HEAD~3
master^^^ == master ~3
git init
New
git clone <url>
Existing
run at the project's top-most directory
creates a .git directory
Initializing
Review previous commit
git show --stat
git show --name-status
info about last commit
git show HEAD
git show HEAD^^^
git show master~10
git show @{yesterday}
git show master@{May.16}
Log
git log
git log --name-status
git log --oneline --graph --all
git log --author="Sean Lynch"
git log --grep="commit.*message.*text"
git log -- some/file
limit by changes to specific file
git timeline / git lol
custom aliases
Branching
git branch <branchname>
git checkout <branchname>
git checkout -b <branchname>
Create new branch and switch to
git branch [-a -l -r]
List branches (all, local, remote)
git merge <branchname>
Merge branch into current branch (ex. master)
Stashing
git stash
git stash [save message]
git stash list
git status apply
git stash clear
git stash branch <branchname>
Making a release (tagging)
git tag -a <name>
Create an annotated tag (with message)
git push --tags
Push tags to remote
git tag
list all tags
Remotes
git remote -v
git remote add <name> <url>
git remote show <name>
git branch --set-upstream master origin/master
Set local branch to track remote branch
git svn
http://git-scm.com/book/en/Git-and-Other-Systems-Git-
and-Subversion
Updating (Push/Pull)
git fetch / git merge
Fetch latest changes from origin, need to
use git merge to apply.
git pull
Pull latest changes from origin (fetch +
merge)
git push [remote_name] [branch_name]
Reverting
git checkout .
Revert changes to all files into working directory,
overwriting any local changes. This is most similar to
"svn revert"
git checkout -- <filename>
Revert changes to a file in working directory
git log --diff-filter=D -- <filename>
git checkout <deleting_commit>^ -- <filename>
Restore a deleted file
Reverting (cont.)
git reset HEAD
Unstage something
git reset HEAD^
forget about a commit, load it back into the staging area
git reset --hard HEAD / git checkout -f
Return to last committed state (discard all local
changes). Can not be undone (without reflog)
Reverting (cont. more)
git commit --amend
Change last commit (correct the previous commit, with
the staged changes)
git revert HEAD
Revert changes (creates a new commit)
Getting Started
Install
Configuration
Ignores
Install
Windows
Git for Windows: http://msysgit.github.com/
Git Extensions:
http://code.google.com/p/gitextensions/
TortoiseGit: http://code.google.com/p/tortoisegit/
Mac
Homebrew: brew install git bash-completion
SourceTree: http://www.sourcetreeapp.com/
GitHub for Mac: http://mac.github.com/
Configuration
git config --global user.name "Sean Lynch"
git config --global user.email "sean.lynch@sbcs.com"
git config --global core.autocrlf true #Windows
git config --global core.autocrlf input #Macs
git config --global color.ui true
git config --global log.decorate true
git config --list
cat ~/.gitconfig
Configuration (aliases)
git config --global alias.st status -s
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.timeline=log --graph --
pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s
%Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
date=relative --all
Ignores
git config --global core.excludesfile
~/.gitignore_global
Collection of .gitignore templates by language /
framework
https://github.com/github/gitignore
Review
git init
git clone
git add
git status
git commit
git log
git branch
git checkout
git merge
git push
git fetch
git pull
Extras - Modifying history
git commit --amend
Modify previous commit. Useful to update
message or include missing file without
creating a new commit
git rebase -i
Rewrite history. Squash, reorder, by
dropping
Extras
git submodule
git subtree
Finding regressions
git bisect start
git bisect good <commit>
git bisect bad <commit>
git bisect visualize
git bisect reset
Best practices
Don't develop off master, use
develop/feature/issue/etc branches
Git
Help / Documentation / Reference
git <command> --help
http://gitref.org/
http://git-scm.com/book
http://help.github.com/
http://www.codingdomain.com/git/tricks/
http://jonas.nitro.dk/git/quick-reference.html
http://gitimmersion.com/
http://marklodato.github.com/visual-git-guide/
Ad

More Related Content

What's hot (19)

Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
Geshan Manandhar
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Suman Mukherjee
 
Git is my hero
Git is my heroGit is my hero
Git is my hero
Selena Deckelmann
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
Yoram Michaeli
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
vimukthirandika
 
Git Basic
Git BasicGit Basic
Git Basic
Luke Luo
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Marco De Stefano
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
KMS Technology
 
Git submodule
Git submoduleGit submodule
Git submodule
Olaf Alders
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
Edward Goikhman
 
Git
GitGit
Git
Parag Gupta
 
Git cli
Git cliGit cli
Git cli
ohb0312
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Introduction to GIT versioning
Introduction to GIT versioningIntroduction to GIT versioning
Introduction to GIT versioning
Stackit Community
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs github
Vinoth Kannan
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
Brian K. Vagnini
 

Similar to Git (20)

Git
GitGit
Git
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
Git and github
Git and githubGit and github
Git and github
Teodora Ahkozidou
 
Git and Github
Git and GithubGit and Github
Git and Github
Teodora Ahkozidou
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
git - the basics
git - the basicsgit - the basics
git - the basics
Arnelle Balane
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
Piotr Benetkiewicz
 
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
Luis Lamadrid
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
Forest Mars
 
What the Git? - WordCamp Atlanta
What the Git? - WordCamp AtlantaWhat the Git? - WordCamp Atlanta
What the Git? - WordCamp Atlanta
Nathaniel Schweinberg
 
Git github
Git githubGit github
Git github
Anurag Deb
 
CraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to gitCraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to git
craftworkz
 
Git
GitGit
Git
Omar Al-Sabek
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
srinathcox
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
Luis Lamadrid
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
Forest Mars
 
CraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to gitCraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to git
craftworkz
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
srinathcox
 
Ad

More from Hanokh Aloni (20)

Negev Game Devs 202304 Abandonware meetup
Negev Game Devs 202304 Abandonware meetupNegev Game Devs 202304 Abandonware meetup
Negev Game Devs 202304 Abandonware meetup
Hanokh Aloni
 
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developerSYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
Hanokh Aloni
 
How to code review for awesomeness and clarity
How to code review for awesomeness and clarityHow to code review for awesomeness and clarity
How to code review for awesomeness and clarity
Hanokh Aloni
 
NWD Total commander for fun and profit!!!
NWD Total commander for fun and profit!!!NWD Total commander for fun and profit!!!
NWD Total commander for fun and profit!!!
Hanokh Aloni
 
CI CD OPS WHATHAVEYOU
CI CD OPS WHATHAVEYOUCI CD OPS WHATHAVEYOU
CI CD OPS WHATHAVEYOU
Hanokh Aloni
 
How to write proper GIT commit messages.pptx
How to write proper GIT commit messages.pptxHow to write proper GIT commit messages.pptx
How to write proper GIT commit messages.pptx
Hanokh Aloni
 
Architectural kata 0 of n.pptx
Architectural kata 0 of n.pptxArchitectural kata 0 of n.pptx
Architectural kata 0 of n.pptx
Hanokh Aloni
 
Code smells (1).pptx
Code smells (1).pptxCode smells (1).pptx
Code smells (1).pptx
Hanokh Aloni
 
NWD the73js.pptx
NWD the73js.pptxNWD the73js.pptx
NWD the73js.pptx
Hanokh Aloni
 
top developer mistakes
top developer mistakes top developer mistakes
top developer mistakes
Hanokh Aloni
 
Things senior developers should know
Things senior developers should knowThings senior developers should know
Things senior developers should know
Hanokh Aloni
 
Cynefin framework in software engineering
Cynefin framework in software engineeringCynefin framework in software engineering
Cynefin framework in software engineering
Hanokh Aloni
 
Microservices
MicroservicesMicroservices
Microservices
Hanokh Aloni
 
Wcbpijwbpij new
Wcbpijwbpij newWcbpijwbpij new
Wcbpijwbpij new
Hanokh Aloni
 
Trunk based vs git flow
Trunk based vs git flowTrunk based vs git flow
Trunk based vs git flow
Hanokh Aloni
 
How to write unmaintainable code
How to write unmaintainable codeHow to write unmaintainable code
How to write unmaintainable code
Hanokh Aloni
 
How i learned to stop worrying and love the logs
How i learned to stop worrying and love the logsHow i learned to stop worrying and love the logs
How i learned to stop worrying and love the logs
Hanokh Aloni
 
Game is ggj2018 presentation
Game is ggj2018 presentationGame is ggj2018 presentation
Game is ggj2018 presentation
Hanokh Aloni
 
Microservices
MicroservicesMicroservices
Microservices
Hanokh Aloni
 
Game is ggj2017 presentation
Game is ggj2017 presentationGame is ggj2017 presentation
Game is ggj2017 presentation
Hanokh Aloni
 
Negev Game Devs 202304 Abandonware meetup
Negev Game Devs 202304 Abandonware meetupNegev Game Devs 202304 Abandonware meetup
Negev Game Devs 202304 Abandonware meetup
Hanokh Aloni
 
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developerSYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
SYSNGS BUGS - definition, lifecycle and what can I do with them as a developer
Hanokh Aloni
 
How to code review for awesomeness and clarity
How to code review for awesomeness and clarityHow to code review for awesomeness and clarity
How to code review for awesomeness and clarity
Hanokh Aloni
 
NWD Total commander for fun and profit!!!
NWD Total commander for fun and profit!!!NWD Total commander for fun and profit!!!
NWD Total commander for fun and profit!!!
Hanokh Aloni
 
CI CD OPS WHATHAVEYOU
CI CD OPS WHATHAVEYOUCI CD OPS WHATHAVEYOU
CI CD OPS WHATHAVEYOU
Hanokh Aloni
 
How to write proper GIT commit messages.pptx
How to write proper GIT commit messages.pptxHow to write proper GIT commit messages.pptx
How to write proper GIT commit messages.pptx
Hanokh Aloni
 
Architectural kata 0 of n.pptx
Architectural kata 0 of n.pptxArchitectural kata 0 of n.pptx
Architectural kata 0 of n.pptx
Hanokh Aloni
 
Code smells (1).pptx
Code smells (1).pptxCode smells (1).pptx
Code smells (1).pptx
Hanokh Aloni
 
top developer mistakes
top developer mistakes top developer mistakes
top developer mistakes
Hanokh Aloni
 
Things senior developers should know
Things senior developers should knowThings senior developers should know
Things senior developers should know
Hanokh Aloni
 
Cynefin framework in software engineering
Cynefin framework in software engineeringCynefin framework in software engineering
Cynefin framework in software engineering
Hanokh Aloni
 
Trunk based vs git flow
Trunk based vs git flowTrunk based vs git flow
Trunk based vs git flow
Hanokh Aloni
 
How to write unmaintainable code
How to write unmaintainable codeHow to write unmaintainable code
How to write unmaintainable code
Hanokh Aloni
 
How i learned to stop worrying and love the logs
How i learned to stop worrying and love the logsHow i learned to stop worrying and love the logs
How i learned to stop worrying and love the logs
Hanokh Aloni
 
Game is ggj2018 presentation
Game is ggj2018 presentationGame is ggj2018 presentation
Game is ggj2018 presentation
Hanokh Aloni
 
Game is ggj2017 presentation
Game is ggj2017 presentationGame is ggj2017 presentation
Game is ggj2017 presentation
Hanokh Aloni
 
Ad

Recently uploaded (20)

Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 

Git

  • 1. Git
  • 2. What is Git? Distributed version control system (DVCS) SVN = Centralized version control system Mercurial, Bazaar are other DVCS Initially designed and developed by Linus Torvalds to manage Linux kernel code base when BitKeeper revoked free license.
  • 5. Git (Distributed VCS) overview (cont)
  • 6. Why Git? Embraced by all major hosting sites: Github, Google Code, CodePlex, BitBucket Used by major projects Linux kernel, Android, ASP.NET MVC, Facebook, Eclipse, Twitter Boostrap, ...
  • 7. • Able to work disconnected (ex. VPN / home) o (Almost) everything is local, fast o Log is always available o Private workspace  Able to commit whenever, create snapshots, push when ready (off VPN, done hacking)  Share when ready, ability to modify previous commits before sharing • Local branching, easily switch gears when customer calls (isolate work units)  features, bug fixes, proof of concepts, etc Why Git? - Benefits
  • 11. Terms HEAD last commit of current branch HEAD^ parent of HEAD master default development branch (trunk) origin default upstream repository (name of remote when git clone was used)
  • 12. Terms (cont.) HEAD^ == HEAD~1 # parent of HEAD HEAD^^^ == HEAD~3 master^^^ == master ~3
  • 13. git init New git clone <url> Existing run at the project's top-most directory creates a .git directory Initializing
  • 14. Review previous commit git show --stat git show --name-status info about last commit git show HEAD git show HEAD^^^ git show master~10 git show @{yesterday} git show master@{May.16}
  • 15. Log git log git log --name-status git log --oneline --graph --all git log --author="Sean Lynch" git log --grep="commit.*message.*text" git log -- some/file limit by changes to specific file git timeline / git lol custom aliases
  • 16. Branching git branch <branchname> git checkout <branchname> git checkout -b <branchname> Create new branch and switch to git branch [-a -l -r] List branches (all, local, remote) git merge <branchname> Merge branch into current branch (ex. master)
  • 17. Stashing git stash git stash [save message] git stash list git status apply git stash clear git stash branch <branchname>
  • 18. Making a release (tagging) git tag -a <name> Create an annotated tag (with message) git push --tags Push tags to remote git tag list all tags
  • 19. Remotes git remote -v git remote add <name> <url> git remote show <name> git branch --set-upstream master origin/master Set local branch to track remote branch git svn http://git-scm.com/book/en/Git-and-Other-Systems-Git- and-Subversion
  • 20. Updating (Push/Pull) git fetch / git merge Fetch latest changes from origin, need to use git merge to apply. git pull Pull latest changes from origin (fetch + merge) git push [remote_name] [branch_name]
  • 21. Reverting git checkout . Revert changes to all files into working directory, overwriting any local changes. This is most similar to "svn revert" git checkout -- <filename> Revert changes to a file in working directory git log --diff-filter=D -- <filename> git checkout <deleting_commit>^ -- <filename> Restore a deleted file
  • 22. Reverting (cont.) git reset HEAD Unstage something git reset HEAD^ forget about a commit, load it back into the staging area git reset --hard HEAD / git checkout -f Return to last committed state (discard all local changes). Can not be undone (without reflog)
  • 23. Reverting (cont. more) git commit --amend Change last commit (correct the previous commit, with the staged changes) git revert HEAD Revert changes (creates a new commit)
  • 25. Install Windows Git for Windows: http://msysgit.github.com/ Git Extensions: http://code.google.com/p/gitextensions/ TortoiseGit: http://code.google.com/p/tortoisegit/ Mac Homebrew: brew install git bash-completion SourceTree: http://www.sourcetreeapp.com/ GitHub for Mac: http://mac.github.com/
  • 26. Configuration git config --global user.name "Sean Lynch" git config --global user.email "[email protected]" git config --global core.autocrlf true #Windows git config --global core.autocrlf input #Macs git config --global color.ui true git config --global log.decorate true git config --list cat ~/.gitconfig
  • 27. Configuration (aliases) git config --global alias.st status -s git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.timeline=log --graph -- pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- date=relative --all
  • 28. Ignores git config --global core.excludesfile ~/.gitignore_global Collection of .gitignore templates by language / framework https://github.com/github/gitignore
  • 29. Review git init git clone git add git status git commit git log git branch git checkout git merge git push git fetch git pull
  • 30. Extras - Modifying history git commit --amend Modify previous commit. Useful to update message or include missing file without creating a new commit git rebase -i Rewrite history. Squash, reorder, by dropping
  • 32. Finding regressions git bisect start git bisect good <commit> git bisect bad <commit> git bisect visualize git bisect reset
  • 33. Best practices Don't develop off master, use develop/feature/issue/etc branches
  • 35. Help / Documentation / Reference git <command> --help http://gitref.org/ http://git-scm.com/book http://help.github.com/ http://www.codingdomain.com/git/tricks/ http://jonas.nitro.dk/git/quick-reference.html http://gitimmersion.com/ http://marklodato.github.com/visual-git-guide/

Editor's Notes

  • #5: Uses hashes (SHA1) instead of incrementing version numbers due to no central authority
  • #8: Push full history to another server / remote ex. Start developing locally, then decide to push to server, Github, Google Code, etc. Later decide to change remote (switch from Google Code to Github, etc)
  • #9: staging area == index working directory == working tree local repo, HEAD remote repo, origin
  • #11: http://git-scm.com/book/en/Git-Branching-What-a-Branch-Is
  • #12: HEAD parent of next commit
  • #14: git init == svnadmin create <repo> git clone <url> == svn checkout <url> Later add remote if "git init" used git remote add origin [email protected]:username/Hello-World.git git pull -u origin master
  • #15: git show == git show HEAD git show --name-status ~= git diff HEAD^ --name-status
  • #16: git timeline is an alias for git log with flags git log == git log HEAD git log branchB..branchA git log branchA ^branchB show me commits reachable by branchA that are not reachable by branchB git log master..wiki git log wiki ^master git log master.. # HEAD of current branch show me the commits in my wiki branch not in master git log origin/master ^master git log ..@{u} get incoming (need to do a fetch first). What is on master branch on remote/server not in working context git log ^master origin/master git log @{u}.. get outgoing (all commits committed not yet pushed)
  • #17: One working directory for all branches, fast context switching (git checkout), not like SVN (one for trunk, one for each branch, etc) git branch <branchname> <start-point> git branch -t <branchname> <start-point> git reset --merge Cancel a conflicting merge (In git 1.7.0 or later) git merge --ff-only Fast forward merge only. Guarantees no conflicts. Means branch must have already merged up to HEAD of current branch git branch <branchname> <sha1> git checkout -b <branchname> <sha1> Create a branch from a commit (sha1). checkout will also automatically switch/checkout to new branch git branch <branchname> <sha1> git fetch git reset --HARD origin/master Create branch at current master/HEAD, and the move master/HEAD to origin/master. Helpful if master has diverged from origin/master, and you want to sync up with master and then merge in your changes slowly. == Branching and Merging == List: git branch Create: git branch testing Checkout: git checkout testing # work, make some commits Back: git checkout master Merge: git merge testing Create: git checkout -b new-branch Delete: git branch -d new-branch git merge origin/master Checkout remote branch (not already checked out) and track git checkout -t origin/develop http://gitready.com/intermediate/2009/01/09/checkout-remote-tracked-branch.html
  • #18: If need to change branches with outstanding changes
  • #19: http://www.codingdomain.com/git/tricks/
  • #20: remote = alias for url git branch --set-upstream master origin/master What git clone does by default for master git remote set-branches origin master my_other_branch Replace any branches currently being tracked and now track "master" and "my_other_branch" git remote set-branches origin --add my_new_branch Add "my_new_branch" as a tracking branch (doesn't remote existing) git branch foo origin/foo git push git push origin master git push origin [branchname] Can use Subversion as a remote
  • #21: git fetch is helpful to update local copy of logs, etc git pull == svn update
  • #22: replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept http://gitready.com/beginner/2009/01/11/reverting-files.html http://www.cheatography.com/samcollett/cheat-sheets/git/ http://www.codingdomain.com/git/tricks/ http://cheat.errtheblog.com/s/git/ http://bryan-murdock.blogspot.com/2007/07/git-revert-is-not-equivalent-to-svn.html
  • #23: git reset HEAD == git reset --mixed HEAD http://git-scm.com/2011/07/11/reset.html http://stackoverflow.com/questions/927358/git-undo-last-commit
  • #26: More: http://git-scm.com/downloads/guis
  • #27: http://help.github.com/line-endings/ # http://stackoverflow.com/questions/231211/using-git-how-do-i-find-modified-files-between-local-and-remote git config --global alias.incoming '!git remote update -p; git log ..@{u}' git config --global alias.outgoing 'log @{u}..'
  • #29: http://help.github.com/ignore-files/
  • #30: http://gitref.org/
  • #34: Anything in the master branch should always be deployable http://nvie.com/posts/a-successful-git-branching-model/ http://justinhileman.info/article/changing-history/ git-flow
  • #36: Workflow http://nvie.com/posts/a-successful-git-branching-model/