how to use git branch
TRANSCRIPT
![Page 1: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/1.jpg)
GIT BRANCHINGPHUOC NGUYEN
![Page 2: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/2.jpg)
Contents Git Branch Git Checkout, Revert and Reset
Git Workflow Models
![Page 3: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/3.jpg)
It's important to understand that branches are just pointers to commits. When you create a branch, all Git needs to do is create a new pointer —it doesn’t change the repository in any other way.
![Page 4: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/4.jpg)
Git Checkout Checkout a commit Checkout a file Checkout a branch
![Page 5: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/5.jpg)
The lifecycle of the status of your files
![Page 6: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/6.jpg)
Git Revert Generate a new commit that undoes all of the changes introduced in <commit>, then apply it to the current branch.
Git Revert does not “revert” back to the previous state of a project
![Page 7: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/7.jpg)
Git Reset Git Reset should only be used to undo local changes.
![Page 8: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/8.jpg)
CompareCommit File Branch
Git CheckoutMakes the entire working directory match that commit
Unmodify a modified file
Change to another branch
Git RevertUndo a committed snapshot
- -
Git ResetRemove all subsequent commits
Unstage a staged file
Remove all subsequent commits
![Page 9: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/9.jpg)
Workflow Models Centralize Workflow Feature Branch Workflow Gitflow Workflow Forking Workflow
![Page 10: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/10.jpg)
Gitflow Workflow ModelThe Gitflow Workflow still uses a central repository as the communication hub for all developers.
As in the other workflows, developers work locally and push branches to the central repo. The only difference is the branch structure of the project.
2 Types of Branches: Main branches & Supporting branches
![Page 11: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/11.jpg)
The Main Branches Master - the main branch where the source code of HEAD always reflects a production-ready state.
Develop - the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.
![Page 12: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/12.jpg)
The Main Branches
![Page 13: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/13.jpg)
Supporting branches Feature branches Release branches Hotfix branches
![Page 14: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/14.jpg)
Feature Branches May branch off from: develop
Must merge back into: develop
Branch naming convention: anything except master, develop, release-*, or hotfix-*
![Page 15: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/15.jpg)
Feature Branches
![Page 16: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/16.jpg)
Release Branches May branch off from: develop
Must merge back into: develop and master
Branch naming convention: release-*
![Page 17: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/17.jpg)
Release Branches
![Page 18: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/18.jpg)
Hotfix Branches May branch off from: develop
Must merge back into: develop and master
Branch naming convention: hotfix-*
![Page 19: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/19.jpg)
Hotfix Branches
![Page 20: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/20.jpg)
Workflow Models
![Page 21: How to use Git Branch](https://reader035.vdocuments.mx/reader035/viewer/2022081420/55c58123bb61ebd95d8b485a/html5/thumbnails/21.jpg)
THANK YOU!