Created
November 16, 2015 16:07
-
-
Save dotcomputercraft/95eb43ddc879cbf0be6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT STRATEGY WIKI | |
to create a new feature branch: | |
git fetch --all // gets all the latest from remote | |
git checkout -b <feature-branch-name> origin/master // creates and checks out new branch tracking origin/master | |
to develop on your feature branch: | |
git checkout <feature-branch-name> | |
git pull --rebase origin <feature-branch-name> // makes sure you are working with the latest code from the feature branch | |
git add <file list>, git commit -m "<commit message>" | |
git push origin <feature-branch-name> // creates/updates the new feature branch on remote and sets up local to track the feature remote | |
to put a feature out into the dev environment or to update a feature already in dev: | |
git checkout <feature-branch-name> | |
git pull origin <feature-branch-name> | |
git pull --rebase origin master | |
git push origin <feature-branch-name> | |
git checkout develop | |
git pull origin develop | |
git pull --rebase origin master | |
git merge <feature-branch-name> | |
git push origin develop (might have to add -f flag for force push to develop) | |
to put a feature out to the qa or prod environment once approved in dev: | |
git checkout <feature-branch-name> | |
git pull origin <feature-branch-name> // get the latest from remote | |
git pull --rebase origin master // replay your feature branch's work on top of the latest from master | |
git push origin HEAD:master // place the new commits on top of master branch on remote | |
git checkout master | |
git pull origin master // pulls the latest now that we have added new commits onto remote master | |
branch naming conventions: | |
choose one of the following based on context: | |
feature/<dash-separated-context> | |
bugfix/<dash-separated-context> | |
hotfix/<dash-separated-context> | |
commit message conventions: | |
always begin the commit message with the full branch name followed by a colon | |
followed by a brief explanation of what you did | |
extra notes: | |
never rebase a feature branch off develop | |
if develop ever becomes too far from master, or in a weird state at all do not hesitate to delete it from local and remote, recreate it off master, and put whatever feature branches back onto it. with this git strategy, this should never be a problem: | |
git checkout master | |
git push origin --delete develop // removes remote's develop branch | |
git branch -D develop // removes local develop branch | |
git checkout -b develop // creates a new local develop branch | |
after a feature branch has been successfully deployed to production, and its clear that it is working and stable, remove it from the repo for cleanliness purposes with: | |
git push origin --delete <feature-branch-name> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment