Cheatography
https://cheatography.com
Git WorkFlow - Feature Branching
Create new feature branch
git checkout master
git fetch --all
git pull --rebase
git checkout -b feature/####
|
Always create feature, fix or hotfix branch from master.
|
Merge into dev or any enviroment branch
git checkout dev
git fetch --all
git pull --rebase
git merge --no-commit --no-ff feature/####
if have merge conflicts resolve them with any tool. Theb:
git commit -m "Merge feature/### into Dev"
git push origin dev
|
* --no-commit
Indicates don't create an inmediate commit.
* --no-ff
No fast Fordwards. This keep yout repo history cleaner
Delete branches already on master
git branch -r --merged master
git branch -r | egrep "(*|branch1|branch2)" | sed 's/origin\///' | xargs -n 1 git push origin --delete
|
* -r includes all remote branches
* "(*|branch1|branch2)" include all branches for first command.
Pull master changes into working branch
git checkout master
git fetch --all
git pull --rebase
git checkout workingbranch
git rebase master
if have merge conflicts resolve them with any tool.
Then:
git rebase --continue
else
git push origin workingbranch
|
Create RC Branch
git checkout master
git fetch --all
git pull --rebase
git checkout -b RC/1.0.0.#
/Merge or PR all feature branches for the release/
|
Reset branch
git checkout working branch
git reset --hard
git push origin working branch
|
Recomendations
Can i merge dev into master? No
|
Can i merge two features? It's not recommended, but if this is a must, yor can create a third branch, witch contains both features
|
How often must pull master changes? At least once weeak must pull master changes to all branches
|
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets