Git and git flow

Fran García
Fran GarcíaSenior Software Developer um Engage Sciences
Git flow & Git
Init a project with existing files
git flow init
Creates two branches:
master (production release)
develop (next release)
Supported branches prefixes:
feature
release
hotfix
After finishing "my-hotfix", master and develop have the
commits made in the hotfix branch
Hotfixes workflow
Command master my-hotfix develop
git flow hotfix start my-hotfix
working in hotfix
git commit -am "msg"
git flow hotfix finish my-hotfix
git flow hotfix start my-hotfix
is equivalent to the next git commands
git checkout master
git branch hotfix/my-hotfix
git checkout hotfix/my-hotfix
or
git checkout -b hotfix/my-hotfix master
Starting a hotfix
git flow hotfix finish my-hotfix
is equivalent to the next git commands
git checkout master
git merge --no-ff hotfix/my-hotfix
git checkout develop
git merge --no-ff hotfix/my-hotfix
git branch -d hotfix/my-hotfix
don't forget to push master and develop into origin
git push origin [master|develop]
Finishing a hotfix
After finishing "my-feature", only develop has the commits
made in the feature branch
Features workflow
Command master my-feature develop
git flow feature start my-feature
working in feature
git commit -am "msg"
git flow feature finish my-feature
git flow feature start my-feature
is equivalent to the next git commands
git checkout develop
git branch feature/my-feature
git checkout feature/my-feature
or
git checkout -b feature/my-feature develop
Starting a feature
git flow feature finish my-feature
is equivalent to the next git commands
git checkout develop
git merge --no-ff feature/my-feature
git branch -d feature/my-feature
don't forget to push develop into origin
git push origin develop
Finishing a feature
After finishing "v2.0", master and develop have the commits
made in the release branch
Releases workflow
Command master v2.0 develop
git flow release start v2.0
working in release
git commit -am "msg"
git flow feature finish v2.0
git flow release start my-release
is equivalent to the next git commands
git checkout develop
git branch release/my-release
git checkout release/my-release
or
git checkout -b release/my-release develop
Starting a release
git flow release finish my-release
is equivalent to the next git commands
git checkout master
git merge --no-ff release/my-release
git tag -a my-release
git checkout develop
git merge --no-ff release/my-release
git branch -d release/my-release
don't forget to push master and develop into origin
git push origin [master|develop]
Finishing a release
Hotfixes
git checkout master
git pull
git checkout hotfix-branch
git merge master
Features
git checkout develop
git pull
git checkout feature-branch
git merge develop
What if my branch gets obsolete?
git flow [hotfix|feature|release] publish my-branch
you can checkout remote branches like this
git checkout -b my-branch origin/my-branch
don't forget to remove them when they are not needed
anymore
git push origin :my-branch
Publishing remote branches
Suitable to support old versions of the software but in a
very EXPERIMENTAL status and NOT RECOMENDABLE
for production environments
git flow support start v1.1.1 v1.0
Support branches
Useful git
commands
Log of the last 2 commits
git log -2
Differences in the last 2 commits
git log -2 -p
Differences between commits
git diff 77cf297..eb0df61
gif diff --name-only 77cf297..eb0df61f
git diff HEAD..HEAD^1 filename
Showing the last commits
Useful when we need to checkout another branch and we
don't still want to commit anything
git stash
git stash list
git stash pop
git stash apply stash@{0}
git stash show stash@{1}
git stash drop stash@{0}
Saving work without committing
If the file hasn't been added to the index
git checkout one.txt
If the file has already been added to the index
git reset HEAD one.txt
If we want to undo a commit but keeping the modifications
git reset --soft sha1_commit
If we want to undo a commit completely
git reset --hard sha1_commit
Throwing changes away
Fixing mistakes
with git
Committing too early
git commit -m "my message"
I forgot to add the file one.txt and I don't want to do another
commit
git add one.txt
git commit --amend
Committing too early again
git add two.txt three.txt
git commit -m "my message"
I don't want the file three.txt in this commit
git reset HEAD^1 three.txt
git commit --amend
Fixing mistakes in previous commits
An error in the file four.txt was introduced in a previous commit
git checkout <SHA1_commit>
vim four.txt
git add four.txt
git commit --amend
git rebase --onto HEAD <SHA1_commit> <branch>
Recovering local deleted branch
git branch -D my-feature
Looking for the last commit in the deleted branch and
getting its SHA1 with git reflog
git branch my-feature <sha1_last_commit>
Links
● http://git-scm.com/documentation
● http://nvie.com/posts/a-successful-git-branching-model/
1 von 24

Recomendados

Git flow Introduction von
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
9.4K views15 Folien
Git flow von
Git flowGit flow
Git flowValerio Como
5.5K views13 Folien
Git workflows presentation von
Git workflows presentationGit workflows presentation
Git workflows presentationMack Hardy
2.7K views22 Folien
Git branching strategies von
Git branching strategiesGit branching strategies
Git branching strategiesjstack
5.2K views21 Folien
A Git Workflow Model or Branching Strategy von
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyVivek Parihar
604 views17 Folien
Git-flow workflow and pull-requests von
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requestsBartosz Kosarzycki
16.1K views27 Folien

Más contenido relacionado

Was ist angesagt?

Git von
GitGit
GitShinu Suresh
772 views51 Folien
Git Branching Model von
Git Branching ModelGit Branching Model
Git Branching ModelLemi Orhan Ergin
138.9K views34 Folien
Intro to git and git hub von
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
1.3K views61 Folien
Github - Git Training Slides: Foundations von
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
3.1K views537 Folien
Learning git von
Learning gitLearning git
Learning gitSid Anand
2.4K views43 Folien
git flow von
git flowgit flow
git flowGabriel Gottgtroy Zigolis
4K views16 Folien

Was ist angesagt?(20)

Github - Git Training Slides: Foundations von Lee Hanxue
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue3.1K views
Learning git von Sid Anand
Learning gitLearning git
Learning git
Sid Anand2.4K views
Git Series. Episode 3. Git Flow and Github-Flow von Mikhail Melnik
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
Mikhail Melnik3.5K views
A successful Git branching model von abodeltae
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae1.1K views
Git slides von Nanyak S
Git slidesGit slides
Git slides
Nanyak S286 views
Git real slides von Lucas Couto
Git real slidesGit real slides
Git real slides
Lucas Couto3.5K views
Git - Basic Crash Course von Nilay Binjola
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola1.6K views
Git and GitFlow branching model von Pavlo Hodysh
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
Pavlo Hodysh1.3K views

Destacado

Web 2.0 - From a Social to a Service Web von
Web 2.0 - From a Social to a Service WebWeb 2.0 - From a Social to a Service Web
Web 2.0 - From a Social to a Service WebJury Konga
2.1K views48 Folien
Micro Web Service - Slim and JWT von
Micro Web Service - Slim and JWTMicro Web Service - Slim and JWT
Micro Web Service - Slim and JWTTuyen Vuong
3.9K views15 Folien
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani von
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
39.9K views62 Folien
Por su seguridad von
Por su seguridadPor su seguridad
Por su seguridadJose Manuel Ortega Candel
531 views3 Folien
Groovy&Grails: desarrollo rápido de aplicaciones von
Groovy&Grails: desarrollo rápido de aplicacionesGroovy&Grails: desarrollo rápido de aplicaciones
Groovy&Grails: desarrollo rápido de aplicacionesFran García
128 views46 Folien
Privacidad internet von
Privacidad internetPrivacidad internet
Privacidad internetJose Manuel Ortega Candel
295 views3 Folien

Destacado(20)

Web 2.0 - From a Social to a Service Web von Jury Konga
Web 2.0 - From a Social to a Service WebWeb 2.0 - From a Social to a Service Web
Web 2.0 - From a Social to a Service Web
Jury Konga2.1K views
Micro Web Service - Slim and JWT von Tuyen Vuong
Micro Web Service - Slim and JWTMicro Web Service - Slim and JWT
Micro Web Service - Slim and JWT
Tuyen Vuong3.9K views
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani von vvaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani39.9K views
Groovy&Grails: desarrollo rápido de aplicaciones von Fran García
Groovy&Grails: desarrollo rápido de aplicacionesGroovy&Grails: desarrollo rápido de aplicaciones
Groovy&Grails: desarrollo rápido de aplicaciones
Fran García128 views
Groovy&Grails: desarrollo rápido de aplicaciones von Fran García
Groovy&Grails: desarrollo rápido de aplicacionesGroovy&Grails: desarrollo rápido de aplicaciones
Groovy&Grails: desarrollo rápido de aplicaciones
Fran García2.2K views
Working with the AOSP - Linaro Connect Asia 2013 von Opersys inc.
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.5.1K views
Framework de test spock von Fran García
Framework de test spock Framework de test spock
Framework de test spock
Fran García829 views
Json web token api authorization von Giulio De Donato
Json web token api authorizationJson web token api authorization
Json web token api authorization
Giulio De Donato15.2K views
Metodologías agiles de desarrollo de software von Domingo Gallardo
Metodologías agiles de desarrollo de softwareMetodologías agiles de desarrollo de software
Metodologías agiles de desarrollo de software
Domingo Gallardo3.7K views

Similar a Git and git flow

Checkitmobile - using Git for development von
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for developmentGerrit Wanderer
1.1K views18 Folien
Git development workflow von
Git development workflowGit development workflow
Git development workflowSankar Suda
290 views23 Folien
Mastering git - Workflow von
Mastering git - WorkflowMastering git - Workflow
Mastering git - WorkflowTahsin Abrar
436 views13 Folien
Git commands von
Git commandsGit commands
Git commandsViyaan Jhiingade
4K views10 Folien
Managing releases effectively through git von
Managing releases effectively through gitManaging releases effectively through git
Managing releases effectively through gitMohd Farid
1.1K views31 Folien
GIT in a nutshell von
GIT in a nutshellGIT in a nutshell
GIT in a nutshellalignan
309 views30 Folien

Similar a Git and git flow(20)

Checkitmobile - using Git for development von Gerrit Wanderer
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
Gerrit Wanderer1.1K views
Git development workflow von Sankar Suda
Git development workflowGit development workflow
Git development workflow
Sankar Suda290 views
Mastering git - Workflow von Tahsin Abrar
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
Tahsin Abrar436 views
Managing releases effectively through git von Mohd Farid
Managing releases effectively through gitManaging releases effectively through git
Managing releases effectively through git
Mohd Farid1.1K views
GIT in a nutshell von alignan
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
alignan309 views
Pro git - grasping it conceptually von seungzzang Kim
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
seungzzang Kim7.3K views
Gitflow - Una metología para manejo de Branches von Javier Alvarez
Gitflow - Una metología para manejo de BranchesGitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de Branches
Javier Alvarez1.7K views
Gitflow - Branching and Merging Flow for Git von Maulik Shah
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah56 views
Gitflow - Branching and Merging Flow for Git von Maulik Shah
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah125 views
Advanced Git Tutorial von Sage Sharp
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp11.7K views
Git Tricks — git utilities that make life git easier von Christoph Matthies
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies1.2K views
Gitt and Git-flow von Md. Masud
Gitt and Git-flowGitt and Git-flow
Gitt and Git-flow
Md. Masud1.1K views

Último

Data-centric AI and the convergence of data and model engineering: opportunit... von
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
34 views40 Folien
Report 2030 Digital Decade von
Report 2030 Digital DecadeReport 2030 Digital Decade
Report 2030 Digital DecadeMassimo Talia
14 views41 Folien
PharoJS - Zürich Smalltalk Group Meetup November 2023 von
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023Noury Bouraqadi
120 views17 Folien
Melek BEN MAHMOUD.pdf von
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 Folie
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... von
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...Bernd Ruecker
26 views69 Folien
Business Analyst Series 2023 - Week 3 Session 5 von
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
209 views20 Folien

Último(20)

Data-centric AI and the convergence of data and model engineering: opportunit... von Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 von Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... von Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker26 views
Business Analyst Series 2023 - Week 3 Session 5 von DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
Five Things You SHOULD Know About Postman von Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
Special_edition_innovator_2023.pdf von WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 views
Unit 1_Lecture 2_Physical Design of IoT.pdf von StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec11 views
From chaos to control: Managing migrations and Microsoft 365 with ShareGate! von sammart93
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
sammart939 views
The details of description: Techniques, tips, and tangents on alternative tex... von BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
Spesifikasi Lengkap ASUS Vivobook Go 14 von Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 views
Perth MeetUp November 2023 von Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
Case Study Copenhagen Energy and Business Central.pdf von Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana12 views
Lilypad @ Labweek, Istanbul, 2023.pdf von Ally339821
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally3398219 views

Git and git flow

  • 2. Init a project with existing files git flow init Creates two branches: master (production release) develop (next release) Supported branches prefixes: feature release hotfix
  • 3. After finishing "my-hotfix", master and develop have the commits made in the hotfix branch Hotfixes workflow Command master my-hotfix develop git flow hotfix start my-hotfix working in hotfix git commit -am "msg" git flow hotfix finish my-hotfix
  • 4. git flow hotfix start my-hotfix is equivalent to the next git commands git checkout master git branch hotfix/my-hotfix git checkout hotfix/my-hotfix or git checkout -b hotfix/my-hotfix master Starting a hotfix
  • 5. git flow hotfix finish my-hotfix is equivalent to the next git commands git checkout master git merge --no-ff hotfix/my-hotfix git checkout develop git merge --no-ff hotfix/my-hotfix git branch -d hotfix/my-hotfix don't forget to push master and develop into origin git push origin [master|develop] Finishing a hotfix
  • 6. After finishing "my-feature", only develop has the commits made in the feature branch Features workflow Command master my-feature develop git flow feature start my-feature working in feature git commit -am "msg" git flow feature finish my-feature
  • 7. git flow feature start my-feature is equivalent to the next git commands git checkout develop git branch feature/my-feature git checkout feature/my-feature or git checkout -b feature/my-feature develop Starting a feature
  • 8. git flow feature finish my-feature is equivalent to the next git commands git checkout develop git merge --no-ff feature/my-feature git branch -d feature/my-feature don't forget to push develop into origin git push origin develop Finishing a feature
  • 9. After finishing "v2.0", master and develop have the commits made in the release branch Releases workflow Command master v2.0 develop git flow release start v2.0 working in release git commit -am "msg" git flow feature finish v2.0
  • 10. git flow release start my-release is equivalent to the next git commands git checkout develop git branch release/my-release git checkout release/my-release or git checkout -b release/my-release develop Starting a release
  • 11. git flow release finish my-release is equivalent to the next git commands git checkout master git merge --no-ff release/my-release git tag -a my-release git checkout develop git merge --no-ff release/my-release git branch -d release/my-release don't forget to push master and develop into origin git push origin [master|develop] Finishing a release
  • 12. Hotfixes git checkout master git pull git checkout hotfix-branch git merge master Features git checkout develop git pull git checkout feature-branch git merge develop What if my branch gets obsolete?
  • 13. git flow [hotfix|feature|release] publish my-branch you can checkout remote branches like this git checkout -b my-branch origin/my-branch don't forget to remove them when they are not needed anymore git push origin :my-branch Publishing remote branches
  • 14. Suitable to support old versions of the software but in a very EXPERIMENTAL status and NOT RECOMENDABLE for production environments git flow support start v1.1.1 v1.0 Support branches
  • 16. Log of the last 2 commits git log -2 Differences in the last 2 commits git log -2 -p Differences between commits git diff 77cf297..eb0df61 gif diff --name-only 77cf297..eb0df61f git diff HEAD..HEAD^1 filename Showing the last commits
  • 17. Useful when we need to checkout another branch and we don't still want to commit anything git stash git stash list git stash pop git stash apply stash@{0} git stash show stash@{1} git stash drop stash@{0} Saving work without committing
  • 18. If the file hasn't been added to the index git checkout one.txt If the file has already been added to the index git reset HEAD one.txt If we want to undo a commit but keeping the modifications git reset --soft sha1_commit If we want to undo a commit completely git reset --hard sha1_commit Throwing changes away
  • 20. Committing too early git commit -m "my message" I forgot to add the file one.txt and I don't want to do another commit git add one.txt git commit --amend
  • 21. Committing too early again git add two.txt three.txt git commit -m "my message" I don't want the file three.txt in this commit git reset HEAD^1 three.txt git commit --amend
  • 22. Fixing mistakes in previous commits An error in the file four.txt was introduced in a previous commit git checkout <SHA1_commit> vim four.txt git add four.txt git commit --amend git rebase --onto HEAD <SHA1_commit> <branch>
  • 23. Recovering local deleted branch git branch -D my-feature Looking for the last commit in the deleted branch and getting its SHA1 with git reflog git branch my-feature <sha1_last_commit>