SlideShare una empresa de Scribd logo
1 de 31
Git and Git Workflow
Best Practices
Majid Hosseini
Scala Backend Developer @ ModernPal
www.linkedin.com/in/majidin
Base command
● git init
● git commit -m
● git add
● git clone <address> [directoryName]
● git status -s
● git diff / git diff --cached / git diff --staged / git diff HEAD
● git commit => git config --global core.editor
○ git commit -a -m 'added new benchmarks
● rm vs git rm
● git mv
Repository
.gitignore
● Blank lines or lines starting with # are ignored.
● Standard glob patterns work, and will be applied recursively throughout the entire working tree.
● You can start patterns with a forward slash (/) to avoid recursivity.
● You can end patterns with a forward slash (/) to specify a directory.
● You can negate a pattern by starting it with an exclamation point (!).
Tip: https://github.com/github/gitignore
Git log
● git log / git log -p -2 (--patch)
● git log --stat
● git log --pretty=...
○ git log --pretty=oneline
○ git log --pretty=format:"%h - %an, %ar : %s" (more format)
○ git log --pretty=format:"%h %s" --graph
○ git log --since=2.weeks / “2 years 1 day 3 minutes ago” / “2018-01-15”/ --author / --grep
○ git log -S [functionName]
○ git log --oneline --graph --all
Undoing Things
● git commit --amend
○ Combine staged change to previous commit
○ Change commit message
● git reset HEAD <file> #Unstaging a Staged File
● git reset --hard # removes staged and working directory changes
○ git reset --hard 0254ea7
● git checkout -- CONTRIBUTING.md
● git clean -f -d # remove untracked
● git clean -f -x -d # CAUTION: as above but removes ignored files like config.
● git clean -fxd :/ # CAUTION: as above, but cleans untracked and ignored files through the entire
repo (without :/, the operation affects only the current directory)
● git revert #Instead of removing the commit from the project history
○ -n/--no-commit
Git Stash
By default, running git stash will stash:
● changes that have been added to your index (staged changes)
● changes made to files that are currently tracked by Git (unstaged changes)
But it will not stash:
● new files in your working copy that have not yet been staged
● files that have been ignored
commands:
● git stash
● git stash pop/apply
● git stash -u/--include-untracked
● git stash -a/--all #ignore-files
● git stash list
● git stash save "some description"
● git stash pop stash@{2}
Git Stash
● git stash show -p
○ Stash this hunk [y,n,q,a,d,/,e,?]? N
● git stash branch <baranch_name> stash@{1}
● git stash drop stash@{1}
● git stash clear
● git blame -L 1,5 <fileName>
Git Blame (more in UI tools)
Remotes
● git remote -v
● git remote add <name> <url>
● git fetch <remote>
● git remote show <remote>
● git remote rename <old> <new>
● git remote remove <remote>
Tagging
● git tag
● Types
○ Lightweight: like a branch that doesn’t change (It’s just a pointer to a specific commit)
■ git tag v1.4-lw
○ Annotated: They’re checksummed;contain the tagger name, email, and date; have a tagging message; and
can be signed and verified with GNU Privacy Guard (GPG) encrypt and sign your data and communications
■ git tag -a v1.4 -m “my version 1.4”
● git show <tagname>
● git tag -a v1.2 9fceb02
● git push origin <tagname> / git push origin --tags
● git checkout <tagname>
● git checkout -b <new_branch_name> <tagname>
Aliases
● git config --global alias.co checkout
● git config --global alias.br branch
● git config --global alias.ci commit
● git config --global alias.st status
● git config --global alias.unstage 'reset HEAD --'
● git config --global alias.last 'log -1 HEAD'
Branching and Merging (three-way merge)
● git checkout -b <branch_name>
● git branch <branch_name> -> git checkout <branch_name>
● git merge <branch_name>
○ git merge --no-ff #keep all of your commits from your feature branch
○ git merge --squash #combine your commits and clean up your repo
● git branch -d/-D <branch_name>
● git mergetool
● git branch -v / git branch --merged / git branch --no-merged / git branch -vv
● git ls-remote <remote> / git remote show <remote>
● git remote add <remote> <address>
Branching and Merging (three-way merge)
● git cherry-pick
● git checkout -b <branch_name> <remote>/<branch_name> (Tracking - upstream branch/ direct
relationship to a remote branch)
● git checkout --track <remote>/<branch_name>
● git branch -u <remote>/<branch_name> or --set-upstream-to
Note: “origin” is not special (git clone -o <name_replace_to_origin>)
● git fetch origin
● git fetch origin
● git fetch origin
● git push <remote> --delete <branch>
● git rebase
○ -i
○ -s #squash
Branching and Merging (three-way merge)
● git push <remote> --delete <branch>
● git rebase
● git pull --rebase
Branching and Merging (three-way merge)
Git Workflows
What is a successful Git workflow?
● Does this workflow scale with team size?
● Is it easy to undo mistakes and errors with this workflow?
● Does this workflow impose any new unnecessary cognitive overhead to the team?
And
● There is no one-size-fits-all Git workflow
● A workflow should be simple and enhance the productivity of your team
● Your business requirements should help shape your Git workflow
Centralized Workflow
the Centralized Workflow uses a central repository to serve as the single point-of-entry for all changes
to the project (A great Git workflow for teams transitioning from SVN)
● Central repositories should always be bare repositories (they shouldn’t have a working directory)
ssh user@host git init --bare /path/to/repo.git
● git pull --rebase origin master
○ After conflict and fix it run:
■ git add <some-file>
■ git rebase --continue
○ Or
■ git rebase --abort
Feature branching
● Continuous Integration Environments
● Encapsulating feature
Gitflow Workflow
● managing larger projects
● for projects that have a
scheduled release cycle
● Git-flow
○ git flow feature start feature_branch
○ git flow feature finish feature_branch
○ git flow release start 0.1.0
○ git flow hotfix start hotfix_branch
Gitflow Workflow
The overall flow of Gitflow is:
1. A develop branch is created from master
2. A release branch is created from develop
3. Feature branches are created from develop
4. When a feature is complete it is merged into the develop branch
5. When the release branch is done it is merged into develop and master
6. If an issue in master is detected a hotfix branch is created from master
7. Once the hotfix is complete it is merged to both develop and master
Forking Workflow
● most often seen in public open source projects
● contributions can be integrated without the need for everybody to push to a single central
repository
● do not directly clone the official repository
● git remote add upstream https://bitbucket.org/maintainer/repo
● git pull upstream master
Forking Workflow
1. A developer 'forks' an 'official' server-side repository. This creates their own server-side copy.
2. The new server-side copy is cloned to their local system.
3. A Git remote path for the 'official' repository is added to the local clone.
4. A new local feature branch is created.
5. The developer makes changes on the new branch.
6. New commits are created for the changes.
7. The branch gets pushed to the developer's own server-side copy.
8. The developer opens a pull request from the new branch to the 'official' repository.
9. The pull request gets approved for merge and is merged into the original server-side repository
Branching Workflows
Long-Running Branches
Linear view
Branching Workflows
Long-Running Branches
Silo View
Branching Workflows
Topic Branches (useful in projects of any size)
A theme for oh-my-zsh
Thanks to everyone
Resources:
● git-scm.com
● atlassian.com/git/tutorials

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Learning git
Learning gitLearning git
Learning git
 
Git
GitGit
Git
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Github
GithubGithub
Github
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Bitbucket and Git
Bitbucket and GitBitbucket and Git
Bitbucket and Git
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git slides
Git slidesGit slides
Git slides
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
 
git and github
git and githubgit and github
git and github
 
Git Series. Episode 3. Git Flow and Github-Flow
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
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Git training v10
Git training v10Git training v10
Git training v10
 

Similar a Git and git workflow best practice

Git tech talk
Git tech talkGit tech talk
Git tech talk
razasayed
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
siva ram
 

Similar a Git and git workflow best practice (20)

Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
How to git easily in day to-day work
How to git easily in day to-day workHow to git easily in day to-day work
How to git easily in day to-day work
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
 
Git Intermediate Course
Git Intermediate CourseGit Intermediate Course
Git Intermediate Course
 
Git github
Git githubGit github
Git github
 
Git basics 2
Git basics 2Git basics 2
Git basics 2
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 
Git tips
Git tipsGit tips
Git tips
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Introduction to git, a version control system
Introduction to git, a version control systemIntroduction to git, a version control system
Introduction to git, a version control system
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
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
 

Último (20)

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
 
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
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
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
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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-...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
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
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
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
 
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 ☂️
 
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
 

Git and git workflow best practice

  • 1. Git and Git Workflow Best Practices Majid Hosseini Scala Backend Developer @ ModernPal www.linkedin.com/in/majidin
  • 2. Base command ● git init ● git commit -m ● git add ● git clone <address> [directoryName] ● git status -s ● git diff / git diff --cached / git diff --staged / git diff HEAD ● git commit => git config --global core.editor ○ git commit -a -m 'added new benchmarks ● rm vs git rm ● git mv
  • 4. .gitignore ● Blank lines or lines starting with # are ignored. ● Standard glob patterns work, and will be applied recursively throughout the entire working tree. ● You can start patterns with a forward slash (/) to avoid recursivity. ● You can end patterns with a forward slash (/) to specify a directory. ● You can negate a pattern by starting it with an exclamation point (!). Tip: https://github.com/github/gitignore
  • 5. Git log ● git log / git log -p -2 (--patch) ● git log --stat ● git log --pretty=... ○ git log --pretty=oneline ○ git log --pretty=format:"%h - %an, %ar : %s" (more format) ○ git log --pretty=format:"%h %s" --graph ○ git log --since=2.weeks / “2 years 1 day 3 minutes ago” / “2018-01-15”/ --author / --grep ○ git log -S [functionName] ○ git log --oneline --graph --all
  • 6. Undoing Things ● git commit --amend ○ Combine staged change to previous commit ○ Change commit message ● git reset HEAD <file> #Unstaging a Staged File ● git reset --hard # removes staged and working directory changes ○ git reset --hard 0254ea7 ● git checkout -- CONTRIBUTING.md ● git clean -f -d # remove untracked ● git clean -f -x -d # CAUTION: as above but removes ignored files like config. ● git clean -fxd :/ # CAUTION: as above, but cleans untracked and ignored files through the entire repo (without :/, the operation affects only the current directory) ● git revert #Instead of removing the commit from the project history ○ -n/--no-commit
  • 7. Git Stash By default, running git stash will stash: ● changes that have been added to your index (staged changes) ● changes made to files that are currently tracked by Git (unstaged changes) But it will not stash: ● new files in your working copy that have not yet been staged ● files that have been ignored commands: ● git stash ● git stash pop/apply ● git stash -u/--include-untracked ● git stash -a/--all #ignore-files ● git stash list ● git stash save "some description" ● git stash pop stash@{2}
  • 8. Git Stash ● git stash show -p ○ Stash this hunk [y,n,q,a,d,/,e,?]? N ● git stash branch <baranch_name> stash@{1} ● git stash drop stash@{1} ● git stash clear ● git blame -L 1,5 <fileName> Git Blame (more in UI tools)
  • 9. Remotes ● git remote -v ● git remote add <name> <url> ● git fetch <remote> ● git remote show <remote> ● git remote rename <old> <new> ● git remote remove <remote>
  • 10. Tagging ● git tag ● Types ○ Lightweight: like a branch that doesn’t change (It’s just a pointer to a specific commit) ■ git tag v1.4-lw ○ Annotated: They’re checksummed;contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG) encrypt and sign your data and communications ■ git tag -a v1.4 -m “my version 1.4” ● git show <tagname> ● git tag -a v1.2 9fceb02 ● git push origin <tagname> / git push origin --tags ● git checkout <tagname> ● git checkout -b <new_branch_name> <tagname>
  • 11. Aliases ● git config --global alias.co checkout ● git config --global alias.br branch ● git config --global alias.ci commit ● git config --global alias.st status ● git config --global alias.unstage 'reset HEAD --' ● git config --global alias.last 'log -1 HEAD'
  • 12. Branching and Merging (three-way merge) ● git checkout -b <branch_name> ● git branch <branch_name> -> git checkout <branch_name> ● git merge <branch_name> ○ git merge --no-ff #keep all of your commits from your feature branch ○ git merge --squash #combine your commits and clean up your repo ● git branch -d/-D <branch_name> ● git mergetool ● git branch -v / git branch --merged / git branch --no-merged / git branch -vv ● git ls-remote <remote> / git remote show <remote> ● git remote add <remote> <address>
  • 13. Branching and Merging (three-way merge) ● git cherry-pick ● git checkout -b <branch_name> <remote>/<branch_name> (Tracking - upstream branch/ direct relationship to a remote branch) ● git checkout --track <remote>/<branch_name> ● git branch -u <remote>/<branch_name> or --set-upstream-to Note: “origin” is not special (git clone -o <name_replace_to_origin>)
  • 14. ● git fetch origin
  • 15. ● git fetch origin
  • 16. ● git fetch origin
  • 17. ● git push <remote> --delete <branch> ● git rebase ○ -i ○ -s #squash Branching and Merging (three-way merge)
  • 18. ● git push <remote> --delete <branch> ● git rebase ● git pull --rebase Branching and Merging (three-way merge)
  • 19. Git Workflows What is a successful Git workflow? ● Does this workflow scale with team size? ● Is it easy to undo mistakes and errors with this workflow? ● Does this workflow impose any new unnecessary cognitive overhead to the team? And ● There is no one-size-fits-all Git workflow ● A workflow should be simple and enhance the productivity of your team ● Your business requirements should help shape your Git workflow
  • 20. Centralized Workflow the Centralized Workflow uses a central repository to serve as the single point-of-entry for all changes to the project (A great Git workflow for teams transitioning from SVN) ● Central repositories should always be bare repositories (they shouldn’t have a working directory) ssh user@host git init --bare /path/to/repo.git ● git pull --rebase origin master ○ After conflict and fix it run: ■ git add <some-file> ■ git rebase --continue ○ Or ■ git rebase --abort
  • 21. Feature branching ● Continuous Integration Environments ● Encapsulating feature
  • 22. Gitflow Workflow ● managing larger projects ● for projects that have a scheduled release cycle ● Git-flow ○ git flow feature start feature_branch ○ git flow feature finish feature_branch ○ git flow release start 0.1.0 ○ git flow hotfix start hotfix_branch
  • 23. Gitflow Workflow The overall flow of Gitflow is: 1. A develop branch is created from master 2. A release branch is created from develop 3. Feature branches are created from develop 4. When a feature is complete it is merged into the develop branch 5. When the release branch is done it is merged into develop and master 6. If an issue in master is detected a hotfix branch is created from master 7. Once the hotfix is complete it is merged to both develop and master
  • 24. Forking Workflow ● most often seen in public open source projects ● contributions can be integrated without the need for everybody to push to a single central repository ● do not directly clone the official repository ● git remote add upstream https://bitbucket.org/maintainer/repo ● git pull upstream master
  • 25. Forking Workflow 1. A developer 'forks' an 'official' server-side repository. This creates their own server-side copy. 2. The new server-side copy is cloned to their local system. 3. A Git remote path for the 'official' repository is added to the local clone. 4. A new local feature branch is created. 5. The developer makes changes on the new branch. 6. New commits are created for the changes. 7. The branch gets pushed to the developer's own server-side copy. 8. The developer opens a pull request from the new branch to the 'official' repository. 9. The pull request gets approved for merge and is merged into the original server-side repository
  • 28. Branching Workflows Topic Branches (useful in projects of any size)
  • 29. A theme for oh-my-zsh
  • 30.
  • 31. Thanks to everyone Resources: ● git-scm.com ● atlassian.com/git/tutorials

Notas del editor

  1. You would create a bare repository to git push and git pull from, but never directly commit to it