SlideShare a Scribd company logo
1 of 25
Senior Software Engineer
Kalpa Welivitigoda
Git | Beyond Basics
**
๏ Initializing a git repository
๏ Adding files
๏ Committing
๏ Adding remotes
๏ Push/Pull
๏ Status
What we know already
**
WSO2/product-as john/product-as
John’s local filesystem
product-as
Fork
Clone
(origin)
Remote
(upstream)
*
*
We are no alone!
WSO2/product-as bill/product-as
john/product-as
John’s local filesystem
product-as
bob/product-as
Bill’s local filesystem
product-as
Bob’s local filesystem
product-as
*
*
Developing a feature
*
*
Keep up with the changes...
*
*
Merge
Vs.
Rebase
*
*
git merge
$ git checkout feature
$ git merge master
๏ Non destructive mechanism
๏ Additional commit
*
*
git rebase
$ git checkout feature
$ git rebase master
๏ Cleaner commit history
๏ Rewrites the history!!!!
**
๏ Very powerful
๏ Clean the commit history before merging to master
branch
$ git rebase -i HEAD~10
Interactive rebase
# Commands:
p, pick = use commit
r, reword = use commit, but edit the commit message
e, edit = use commit, but stop for amending
s, squash = use commit, but meld into previous commit
f, fixup = like "squash", but discard this commit's log
message
x, exec = run command (the rest of the line) using shell
d, drop = remove commit
**
Split commits | Demo
*
*
git stash
๏ A stack of uncommitted changes
๏ Tracks modified files and staged changes
๏ Useful when switching between branches
**
$ git stash
$ git stash save stash1
git stash...
$ git stash list
$ git stash apply
$ git stash apply stash@{1}
$ git stash drop
$ git stash pop
$ git stash -p
$ git checkout stash@{n} -- {{file_path}}
**
Selective stashing | Demo
**
$ git log --oneline
$ git log --decorate
$ git log --stat
$ git log -- graph --oneline --decorate
$ git shortlog
$ gitk
git log
Log formatting
**
$ git log -3
$ git log --after="2016-09-01"
$ git log --after="yesterday"
$ git log --after="1 week ago"
$ git log --author="John|Mary"
$ git log --grep="WSAS"
$ git log -- pom.xml
$ git log -S "maven-deploy-plugin"
$ git log --no-merges
$ git log -- merges
$ git log <since>...<until>
git log...
Log filtering
**
$ git config --global alias.lo "log --oneline"
$ git lo
git alias
**
$ git checkout feature
$ git cherry-pick 5a63064
git cherry-pick
๏ It’s a new commit !!!!
**
$ git reflog
git reflog
๏ git log shows commits in ancestor order
๏ Reflog shows in the order you last referenced the
commits
**
$ git bisect start
$ git bisect good <good commit hash>
$ git bisect bad <bad commit hash>
$ git bisect reset
git bisect
๏ Used to find the commit that introduced a bug/fix
๏ Do a binary search of the commits
**
Git best practices
๏ Develop features in feature branches
๏ Commit often, perfect later, publish once
๏ Never change published history (it is possible with
push -f, but never ever do it)
๏ Keep your git tree clean (git pull upstream master --rebase)
**
Git best practices...
๏ A commit message has a subject and a body.
๏ Make the commit subject imperative
๏ Link to the JIRA/Git Issue ID
๏ WSAS-1169 : <commit subject>
๏ Resolves #21
**
Reference
๏ https://www.atlassian.com/git/tutorials/advanced-
overview
๏ http://chris.beams.io/posts/git-commit/
๏ https://git-scm.com/doc
**
Questions ?
**
Thank You !

More Related Content

What's hot

Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Gitgittower
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advancedYodalee
 
用 Kotlin 做自動化工具
用 Kotlin 做自動化工具用 Kotlin 做自動化工具
用 Kotlin 做自動化工具Shengyou Fan
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 
G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~Tsuyoshi Yamamoto
 
Kotlin 在 Web 方面的应用
Kotlin 在 Web 方面的应用Kotlin 在 Web 方面的应用
Kotlin 在 Web 方面的应用Shengyou Fan
 
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 101615Brian K. Vagnini
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Mizan Riqzia
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about gitSothearin Ren
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code baseRobert Munteanu
 
以 Ktor 快速打造 Web 應用
以 Ktor 快速打造 Web 應用以 Ktor 快速打造 Web 應用
以 Ktor 快速打造 Web 應用Shengyou Fan
 

What's hot (20)

Git
GitGit
Git
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Hello git
Hello git Hello git
Hello git
 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git github
Git githubGit github
Git github
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advanced
 
用 Kotlin 做自動化工具
用 Kotlin 做自動化工具用 Kotlin 做自動化工具
用 Kotlin 做自動化工具
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 
G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~
 
Git101
Git101Git101
Git101
 
Kotlin 在 Web 方面的应用
Kotlin 在 Web 方面的应用Kotlin 在 Web 方面的应用
Kotlin 在 Web 方面的应用
 
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
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
 
Gaelyk
GaelykGaelyk
Gaelyk
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
G* on GAE/J 挑戦編
G* on GAE/J 挑戦編G* on GAE/J 挑戦編
G* on GAE/J 挑戦編
 
以 Ktor 快速打造 Web 應用
以 Ktor 快速打造 Web 應用以 Ktor 快速打造 Web 應用
以 Ktor 快速打造 Web 應用
 

Viewers also liked

WSO2 Product Release Webinar: WSO2 Application Server 5.3
WSO2 Product Release Webinar: WSO2 Application Server 5.3WSO2 Product Release Webinar: WSO2 Application Server 5.3
WSO2 Product Release Webinar: WSO2 Application Server 5.3WSO2
 
The Private API Economy
The Private API EconomyThe Private API Economy
The Private API EconomyWSO2
 
Alchemy of the API Economy
Alchemy of the API EconomyAlchemy of the API Economy
Alchemy of the API EconomyWSO2
 
End-to-End Identity Management
End-to-End Identity ManagementEnd-to-End Identity Management
End-to-End Identity ManagementWSO2
 
Identity and Entitlement Management Concepts
Identity and Entitlement Management Concepts Identity and Entitlement Management Concepts
Identity and Entitlement Management Concepts WSO2
 
Identity Management for Web Application Developers
Identity Management for Web Application DevelopersIdentity Management for Web Application Developers
Identity Management for Web Application DevelopersWSO2
 
WSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2
 
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...WSO2
 
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...WSO2
 

Viewers also liked (9)

WSO2 Product Release Webinar: WSO2 Application Server 5.3
WSO2 Product Release Webinar: WSO2 Application Server 5.3WSO2 Product Release Webinar: WSO2 Application Server 5.3
WSO2 Product Release Webinar: WSO2 Application Server 5.3
 
The Private API Economy
The Private API EconomyThe Private API Economy
The Private API Economy
 
Alchemy of the API Economy
Alchemy of the API EconomyAlchemy of the API Economy
Alchemy of the API Economy
 
End-to-End Identity Management
End-to-End Identity ManagementEnd-to-End Identity Management
End-to-End Identity Management
 
Identity and Entitlement Management Concepts
Identity and Entitlement Management Concepts Identity and Entitlement Management Concepts
Identity and Entitlement Management Concepts
 
Identity Management for Web Application Developers
Identity Management for Web Application DevelopersIdentity Management for Web Application Developers
Identity Management for Web Application Developers
 
WSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release WebinarWSO2 Identity Server 5.3.0 - Product Release Webinar
WSO2 Identity Server 5.3.0 - Product Release Webinar
 
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...
WSO2Con USA 2017: Rise to the Challenge with WSO2 Identity Server and WSO2 AP...
 
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...
WSO2Con USA 2017: Managing Verifone’s New Payment Device “Carbon” with WSO2’s...
 

Similar to Git Beyond Basics - Interactive Rebase, Stashing, Log Filtering

Git - a powerful version control tool
Git - a powerful version control toolGit - a powerful version control tool
Git - a powerful version control toolKuo-Le Mei
 
Getting some Git
Getting some GitGetting some Git
Getting some GitBADR
 
Git Aliases of the Gods!
Git Aliases of the Gods!Git Aliases of the Gods!
Git Aliases of the Gods!Atlassian
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17siva ram
 

Similar to Git Beyond Basics - Interactive Rebase, Stashing, Log Filtering (20)

Git - a powerful version control tool
Git - a powerful version control toolGit - a powerful version control tool
Git - a powerful version control tool
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Git Aliases of the Gods!
Git Aliases of the Gods!Git Aliases of the Gods!
Git Aliases of the Gods!
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git basics
Git basicsGit basics
Git basics
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git & gitflow
Git & gitflowGit & gitflow
Git & gitflow
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git
GitGit
Git
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
 

Recently uploaded

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Git Beyond Basics - Interactive Rebase, Stashing, Log Filtering

  • 1. Senior Software Engineer Kalpa Welivitigoda Git | Beyond Basics
  • 2. ** ๏ Initializing a git repository ๏ Adding files ๏ Committing ๏ Adding remotes ๏ Push/Pull ๏ Status What we know already
  • 3. ** WSO2/product-as john/product-as John’s local filesystem product-as Fork Clone (origin) Remote (upstream)
  • 4. * * We are no alone! WSO2/product-as bill/product-as john/product-as John’s local filesystem product-as bob/product-as Bill’s local filesystem product-as Bob’s local filesystem product-as
  • 6. * * Keep up with the changes...
  • 8. * * git merge $ git checkout feature $ git merge master ๏ Non destructive mechanism ๏ Additional commit
  • 9. * * git rebase $ git checkout feature $ git rebase master ๏ Cleaner commit history ๏ Rewrites the history!!!!
  • 10. ** ๏ Very powerful ๏ Clean the commit history before merging to master branch $ git rebase -i HEAD~10 Interactive rebase # Commands: p, pick = use commit r, reword = use commit, but edit the commit message e, edit = use commit, but stop for amending s, squash = use commit, but meld into previous commit f, fixup = like "squash", but discard this commit's log message x, exec = run command (the rest of the line) using shell d, drop = remove commit
  • 12. * * git stash ๏ A stack of uncommitted changes ๏ Tracks modified files and staged changes ๏ Useful when switching between branches
  • 13. ** $ git stash $ git stash save stash1 git stash... $ git stash list $ git stash apply $ git stash apply stash@{1} $ git stash drop $ git stash pop $ git stash -p $ git checkout stash@{n} -- {{file_path}}
  • 15. ** $ git log --oneline $ git log --decorate $ git log --stat $ git log -- graph --oneline --decorate $ git shortlog $ gitk git log Log formatting
  • 16. ** $ git log -3 $ git log --after="2016-09-01" $ git log --after="yesterday" $ git log --after="1 week ago" $ git log --author="John|Mary" $ git log --grep="WSAS" $ git log -- pom.xml $ git log -S "maven-deploy-plugin" $ git log --no-merges $ git log -- merges $ git log <since>...<until> git log... Log filtering
  • 17. ** $ git config --global alias.lo "log --oneline" $ git lo git alias
  • 18. ** $ git checkout feature $ git cherry-pick 5a63064 git cherry-pick ๏ It’s a new commit !!!!
  • 19. ** $ git reflog git reflog ๏ git log shows commits in ancestor order ๏ Reflog shows in the order you last referenced the commits
  • 20. ** $ git bisect start $ git bisect good <good commit hash> $ git bisect bad <bad commit hash> $ git bisect reset git bisect ๏ Used to find the commit that introduced a bug/fix ๏ Do a binary search of the commits
  • 21. ** Git best practices ๏ Develop features in feature branches ๏ Commit often, perfect later, publish once ๏ Never change published history (it is possible with push -f, but never ever do it) ๏ Keep your git tree clean (git pull upstream master --rebase)
  • 22. ** Git best practices... ๏ A commit message has a subject and a body. ๏ Make the commit subject imperative ๏ Link to the JIRA/Git Issue ID ๏ WSAS-1169 : <commit subject> ๏ Resolves #21