SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Git Tricks
Quick Bio
Branching

git pull

git checkout -b new-feature-branch

git add (-A)

git commit -m “Our commit message”

git merge branch-name -m “Merge
message”

git diff <source_branch>
<target_branch>
Git Flow
Github Flow
Resolving
<<<<<<< HEAD
good
=======
bad
>>>>>>> merging-branch

Pick the correct one

Add and commit
git stash
- git status
git stash
git stash pop/apply
git blame
- git blame -L line from/line to
Rebase
git checkout feature-branch
git rebase master
Merge vs. Rebase
Rebase vs. Merge
git log -–pretty=oneline
git checkout -b new-clean-branch
git cherry-pick ab97540637691bd7...
git log
Reset vs. Revert
Revert vs. Reset
Submodules
git submodule add <submodule repo>
<path>
Lines in .gitmodules
Folder in the working directory
Clone a project with
submodules
.gitmodules
git submodule init
git submodule sync
git submodule update (--recursive)
Remove a submodule

git rm --cached submodule_path

git rm .gitmodules

rm -rf submodule_path/.git

git add submodule_path

git commit -m "remove submodule
Update Submodules

cd submodule_dir

git checkout master

git pull

cd ../..

git commit -am “Updated submodule
to version ..”
Tags
Tags vs. Branches

Tag = Stable version

Branch = Development, Features
Work with tags

git tag

git tag -l 'v1.4.2.*'

git tag -a v1.8.6 -m 'Version
1.8.6'

git show v1.86

git push origin v1.8.6
Resources
https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
https://guides.github.com/introduction/flow/
https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting/commit-level-operations
http://nvie.com/posts/a-successful-git-branching-model/
http://wptavern.com/git-and-wordpress-3-tips-to-do-it-better
Contacts:
E-mail: iv.dimova@gmail.com
Twitter: @iv_wp

Weitere ähnliche Inhalte

Was ist angesagt?

Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
Josh Dvir
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
Gareth Hall
 

Was ist angesagt? (20)

Git github
Git githubGit github
Git github
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git
GitGit
Git
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git commands
Git commandsGit commands
Git commands
 
Git 101
Git 101Git 101
Git 101
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Git undo
Git undoGit undo
Git undo
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an example
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 

Andere mochten auch (7)

Git Cards - Powerpoint Format
Git Cards - Powerpoint FormatGit Cards - Powerpoint Format
Git Cards - Powerpoint Format
 
Git & Git Workflows
Git & Git WorkflowsGit & Git Workflows
Git & Git Workflows
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
A simplified Gitflow
A simplified GitflowA simplified Gitflow
A simplified Gitflow
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Branch to branch by Photis Patriotis
Branch to branch by Photis PatriotisBranch to branch by Photis Patriotis
Branch to branch by Photis Patriotis
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 

Ähnlich wie Git Tricks

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Git rewriting git history
Git   rewriting git  historyGit   rewriting git  history
Git rewriting git history
LearningTech
 

Ähnlich wie Git Tricks (20)

simple Git
simple Git simple Git
simple Git
 
Git
GitGit
Git
 
Git
GitGit
Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git
GitGit
Git
 
Git foundation
Git foundationGit foundation
Git foundation
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Git rebase
Git rebaseGit rebase
Git rebase
 
Git cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfGit cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdf
 
Git rewriting git history
Git   rewriting git  historyGit   rewriting git  history
Git rewriting git history
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
How to make friends with git
How to make friends with gitHow to make friends with git
How to make friends with git
 
GDSC GIT AND GITHUB
GDSC GIT AND GITHUB GDSC GIT AND GITHUB
GDSC GIT AND GITHUB
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
Git: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best PracticesGit: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best Practices
 

Mehr von Ivelina Dimova (8)

The Magic of Advanced Debugging
The Magic of Advanced DebuggingThe Magic of Advanced Debugging
The Magic of Advanced Debugging
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
 
The swiss knife of a word press developer
The swiss knife of a word press developerThe swiss knife of a word press developer
The swiss knife of a word press developer
 
The WordPress developer's toolkit
The WordPress developer's toolkit The WordPress developer's toolkit
The WordPress developer's toolkit
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
WordCamp London 2013
WordCamp London 2013WordCamp London 2013
WordCamp London 2013
 
Wc no
Wc noWc no
Wc no
 
WordCamp Sofia 2012
WordCamp Sofia 2012WordCamp Sofia 2012
WordCamp Sofia 2012
 

Kürzlich hochgeladen

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Git Tricks