SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Git Merge, Resets and
Branches
©2019 - A gitfetchvictor production…
Victor J. Pudelski
V. P. of Solutions @ TSC, LLC
Founder/Developer @ Next Link Software, LLC
Developer ~20 yrs
Worked mostly in ECM
(boring stuff)
Started working in git in
2010-ish
Created repos at 4
companies
Was git expert for TSG
Git Merge, Resets and
Braches
Two developers can work on the same files at the same time and it
doesn't have to be scary. Git Merge makes it easy to ensure we can see
what's changed, where conflicts occurred and give us an opportunity to
resolve them peacefully. In general, Git provides tools for rolling files
back, isolating R&D initiatives and much much more. This session will
focus on some more advanced Git commands and how we can use them
in our daily projects to ensure source control is never a burden but an ally
in getting work done quickly, easily and without interrupting other fellow
developers.
Agenda
• GIT Merges and why they aren’t so bad
• Rolling Back mistakes
• Isolating our development
Disclaimer
• Many of the Images are from atlassian.com the creators or
bitbucket. They write some great documentation, check it out
sometime…
• Things here are greatly simplified but can be applied to the
most complex of solutions and teams…
• This is not an all encompassing course. There are so many
resources to use. Find what works for you…
Git Merge is
• Scary Monster
• Very Difficult to recover from
• Takes a PHD in Comp Sci to
understand
NO!
Git Merge is
• A natural part of development
• Easy to identify what
happened
• Can be quick to resolve when
conflict arises
• NOT SCARY!!!
How do you know you need to
merge?
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/vjpudelski/GitMergePractice.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
<<<<<<< HEAD
Program prog = new Program();
prog.CreateMenu();
}
public void CreateMenu(){
Console.WriteLine("Title of Application");
Console.WriteLine();
Console.WriteLine("1 - Search");
Console.WriteLine("2 - Add New");
Console.WriteLine("3 - Delete Item");
=======
Console.WriteLine("GoodBye!");
for (int i = 0; i < 10; i++){
Console.Write("i ");
}
>>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f
<<<<<<< HEAD
Program prog = new Program();
prog.CreateMenu();
}
public void CreateMenu(){
Console.WriteLine("Title of Application");
Console.WriteLine();
Console.WriteLine("1 - Search");
Console.WriteLine("2 - Add New");
Console.WriteLine("3 - Delete Item");
=======
These are the changes
you have made…
=======
Console.WriteLine("GoodBye!");
for (int i = 0; i < 10; i++){
Console.Write("i ");
}
>>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f
These are the changes
They have made!
<<<<<<< HEAD
Program prog = new Program();
prog.CreateMenu();
}
public void CreateMenu(){
Console.WriteLine("Title of Application");
Console.WriteLine();
Console.WriteLine("1 - Search");
Console.WriteLine("2 - Add New");
Console.WriteLine("3 - Delete Item");
=======
Console.WriteLine("GoodBye!");
for (int i = 0; i < 10; i++){
Console.Write("i ");
}
>>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f
Merge creates a commit
• You are saving changes required to combine your code
and other code
• This is why in times of conflict you need to commit again
to complete merge
Did You Know?…
‘git pull’ is actually:
‘git fetch’ & ‘git merge’
DEMO!!!
What if I Mess Up?
• I have created a commit and it is WRONG!
• I don’t need the change
• I need to return to another commit
git reset --hard
“--hard”
• Hard sounds while, hard?
• There is also —mixed and —soft
• Hard - lose changes, totally undone
• Mixed - changes in stage reset to working directory but
nothing lost
• Soft - reset to commit, modified files set to staged (add)
• I accidentally staged a change I shouldn’t have? (MIXED)
• I committed something I shouldn’t have and I want the
change? (SOFT)
• I need to blow away changes? (HARD)
DEMO!!!
Branches
Ever see a tree with 1 and only 1 branch?
GIT Branches
• Isolating Development
• Separating Prod from Dev
codebases
• Separating developers
• Key = separate
Branches
• Isolate code!
• Keep Production codebase clean
• Allow experimentation without effecting production
• git checkout -b <<branch>>
create a new branch
• git branch
see branches
• git merge <<branch>>
merge changes to branch you are on
• git branch -d <<branch>>
git push origin --delete <<branch>>
delete branch (local/remote)
DEMO!!!
GIT Merge & Branches
• You need to be on the destination branch
• You merge into a branch
git merge <<branch>>
• Sometimes you will not have conflict and it will just work
and That’s All Folks!
Recap
• Git Merge is not that scary at all
• If we mess up, we have options
• Can always save our work to separate branches
Victor J. Pudelski
vjpudelski@gmail.com
@vjpudelski on twitter
www.gitfetchvictor.com
THANK YOU!
QUESTIONS?
Bonus #1: git log
git log --graph --pretty=format:'commit: %C(bold
red)%h%Creset %C(red)<%H>%Creset %C(bold
magenta)%d %Creset%ndate: %C(bold yellow)%cd
%Creset%C(yellow)%cr%Creset%nauthor: %C(bold
blue)%an%Creset
%C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'
--pretty=format
commit: abbr commit hash <commit hash> (ref names)
date: Commit Date Commit Date relative
author: Author name <Author email>
Subject
commit: %h <%H> %d
date: %cd %cr
author: %an <%ae>
%s
Bonus #2: Alias
git config --global alias.smartlog "log --graph --
pretty=format:'commit: %C(bold red)%h%Creset
%C(red)<%H>%Creset %C(bold magenta)%d
%Creset%ndate: %C(bold yellow)%cd
%Creset%C(yellow)%cr%Creset%nauthor: %C(bold
blue)%an%Creset
%C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'"
Git Alias
• git config --global alias.smartlog “…”
Add an alias
• git config --global --unset alias.smartlog
Remove the alias

Weitere ähnliche Inhalte

Was ist angesagt?

Git for Beginners
Git for BeginnersGit for Beginners
Git for BeginnersRick Umali
 
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
 
Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHubMichael Redlich
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?John Congdon
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
Container based CI/CD on GitHub Actions
Container based CI/CD on GitHub ActionsContainer based CI/CD on GitHub Actions
Container based CI/CD on GitHub ActionsCasey Lee
 
Using github development process in your company
Using github development process in your companyUsing github development process in your company
Using github development process in your companyIcalia Labs
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flowKnoldus Inc.
 
Engage 2018 adm04 The lazy admin wins
Engage 2018   adm04 The lazy admin winsEngage 2018   adm04 The lazy admin wins
Engage 2018 adm04 The lazy admin winsFactor-y S.r.l.
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucketSumin Byeon
 
Git presentation
Git presentationGit presentation
Git presentationEdson Celio
 

Was ist angesagt? (20)

Git for Beginners
Git for BeginnersGit for Beginners
Git for Beginners
 
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
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHub
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?
 
Github basics
Github basicsGithub basics
Github basics
 
Gerrit Workshop
Gerrit WorkshopGerrit Workshop
Gerrit Workshop
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Container based CI/CD on GitHub Actions
Container based CI/CD on GitHub ActionsContainer based CI/CD on GitHub Actions
Container based CI/CD on GitHub Actions
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git kelvin
Git   kelvinGit   kelvin
Git kelvin
 
Git Pull Requests
Git Pull RequestsGit Pull Requests
Git Pull Requests
 
Using github development process in your company
Using github development process in your companyUsing github development process in your company
Using github development process in your company
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
 
Git 101
Git 101Git 101
Git 101
 
Engage 2018 adm04 The lazy admin wins
Engage 2018   adm04 The lazy admin winsEngage 2018   adm04 The lazy admin wins
Engage 2018 adm04 The lazy admin wins
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
Git presentation
Git presentationGit presentation
Git presentation
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 

Ähnlich wie Git Merge, Resets and Branches

devops-complete-notes-2.pdf
devops-complete-notes-2.pdfdevops-complete-notes-2.pdf
devops-complete-notes-2.pdfRobinRohit2
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answersDeepQuest Software
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testersupadhyay_25
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfmurad khan
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 

Ähnlich wie Git Merge, Resets and Branches (20)

Git github
Git githubGit github
Git github
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
devops-complete-notes-2.pdf
devops-complete-notes-2.pdfdevops-complete-notes-2.pdf
devops-complete-notes-2.pdf
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
01 git interview questions &amp; answers
01   git interview questions &amp; answers01   git interview questions &amp; answers
01 git interview questions &amp; answers
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
3 Git
3 Git3 Git
3 Git
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
 
Git
GitGit
Git
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
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
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
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
 
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
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
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
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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...
 
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-...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
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...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
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
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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
 

Git Merge, Resets and Branches

  • 1. Git Merge, Resets and Branches ©2019 - A gitfetchvictor production…
  • 2. Victor J. Pudelski V. P. of Solutions @ TSC, LLC Founder/Developer @ Next Link Software, LLC Developer ~20 yrs Worked mostly in ECM (boring stuff) Started working in git in 2010-ish Created repos at 4 companies Was git expert for TSG
  • 3. Git Merge, Resets and Braches Two developers can work on the same files at the same time and it doesn't have to be scary. Git Merge makes it easy to ensure we can see what's changed, where conflicts occurred and give us an opportunity to resolve them peacefully. In general, Git provides tools for rolling files back, isolating R&D initiatives and much much more. This session will focus on some more advanced Git commands and how we can use them in our daily projects to ensure source control is never a burden but an ally in getting work done quickly, easily and without interrupting other fellow developers.
  • 4. Agenda • GIT Merges and why they aren’t so bad • Rolling Back mistakes • Isolating our development
  • 5. Disclaimer • Many of the Images are from atlassian.com the creators or bitbucket. They write some great documentation, check it out sometime… • Things here are greatly simplified but can be applied to the most complex of solutions and teams… • This is not an all encompassing course. There are so many resources to use. Find what works for you…
  • 6. Git Merge is • Scary Monster • Very Difficult to recover from • Takes a PHD in Comp Sci to understand
  • 7. NO!
  • 8.
  • 9.
  • 10. Git Merge is • A natural part of development • Easy to identify what happened • Can be quick to resolve when conflict arises • NOT SCARY!!!
  • 11. How do you know you need to merge? ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/vjpudelski/GitMergePractice.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 12. <<<<<<< HEAD Program prog = new Program(); prog.CreateMenu(); } public void CreateMenu(){ Console.WriteLine("Title of Application"); Console.WriteLine(); Console.WriteLine("1 - Search"); Console.WriteLine("2 - Add New"); Console.WriteLine("3 - Delete Item"); ======= Console.WriteLine("GoodBye!"); for (int i = 0; i < 10; i++){ Console.Write("i "); } >>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f
  • 13. <<<<<<< HEAD Program prog = new Program(); prog.CreateMenu(); } public void CreateMenu(){ Console.WriteLine("Title of Application"); Console.WriteLine(); Console.WriteLine("1 - Search"); Console.WriteLine("2 - Add New"); Console.WriteLine("3 - Delete Item"); ======= These are the changes you have made…
  • 14. ======= Console.WriteLine("GoodBye!"); for (int i = 0; i < 10; i++){ Console.Write("i "); } >>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f These are the changes They have made!
  • 15. <<<<<<< HEAD Program prog = new Program(); prog.CreateMenu(); } public void CreateMenu(){ Console.WriteLine("Title of Application"); Console.WriteLine(); Console.WriteLine("1 - Search"); Console.WriteLine("2 - Add New"); Console.WriteLine("3 - Delete Item"); ======= Console.WriteLine("GoodBye!"); for (int i = 0; i < 10; i++){ Console.Write("i "); } >>>>>>> d45ccef3a008e0ebfd1766b6d8fb0e77eb77d88f
  • 16. Merge creates a commit • You are saving changes required to combine your code and other code • This is why in times of conflict you need to commit again to complete merge
  • 17. Did You Know?… ‘git pull’ is actually: ‘git fetch’ & ‘git merge’
  • 19. What if I Mess Up? • I have created a commit and it is WRONG! • I don’t need the change • I need to return to another commit git reset --hard
  • 20. “--hard” • Hard sounds while, hard? • There is also —mixed and —soft • Hard - lose changes, totally undone • Mixed - changes in stage reset to working directory but nothing lost • Soft - reset to commit, modified files set to staged (add)
  • 21. • I accidentally staged a change I shouldn’t have? (MIXED) • I committed something I shouldn’t have and I want the change? (SOFT) • I need to blow away changes? (HARD)
  • 23. Branches Ever see a tree with 1 and only 1 branch?
  • 24. GIT Branches • Isolating Development • Separating Prod from Dev codebases • Separating developers • Key = separate
  • 25.
  • 26. Branches • Isolate code! • Keep Production codebase clean • Allow experimentation without effecting production
  • 27. • git checkout -b <<branch>> create a new branch • git branch see branches • git merge <<branch>> merge changes to branch you are on • git branch -d <<branch>> git push origin --delete <<branch>> delete branch (local/remote)
  • 29. GIT Merge & Branches • You need to be on the destination branch • You merge into a branch git merge <<branch>> • Sometimes you will not have conflict and it will just work and That’s All Folks!
  • 30. Recap • Git Merge is not that scary at all • If we mess up, we have options • Can always save our work to separate branches
  • 31. Victor J. Pudelski vjpudelski@gmail.com @vjpudelski on twitter www.gitfetchvictor.com THANK YOU! QUESTIONS?
  • 32. Bonus #1: git log git log --graph --pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'
  • 33. --pretty=format commit: abbr commit hash <commit hash> (ref names) date: Commit Date Commit Date relative author: Author name <Author email> Subject
  • 34. commit: %h <%H> %d date: %cd %cr author: %an <%ae> %s
  • 35. Bonus #2: Alias git config --global alias.smartlog "log --graph -- pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'"
  • 36. Git Alias • git config --global alias.smartlog “…” Add an alias • git config --global --unset alias.smartlog Remove the alias