GIT BRANCHING PHUOC NGUYEN
GIT BRANCHINGPHUOC NGUYEN
Contents Git Branch Git Checkout, Revert and Reset
Git Workflow Models
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.
Git Checkout Checkout a commit Checkout a file Checkout a branch
The lifecycle of the status of your files
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
Git Reset Git Reset should only be used to undo local changes.
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
Workflow Models Centralize Workflow Feature Branch Workflow Gitflow Workflow Forking Workflow
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
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.
The Main Branches
Supporting branches Feature branches Release branches Hotfix branches
Feature Branches May branch off from: develop
Must merge back into: develop
Branch naming convention: anything except master, develop, release-*, or hotfix-*
Feature Branches
Release Branches May branch off from: develop
Must merge back into: develop and master
Branch naming convention: release-*
Release Branches
Hotfix Branches May branch off from: develop
Must merge back into: develop and master
Branch naming convention: hotfix-*
Hotfix Branches
Workflow Models
THANK YOU!