Created
April 3, 2012 21:38
-
-
Save tschmidt/2295693 to your computer and use it in GitHub Desktop.
My Git Workflow (TL;DR version)
This file contains hidden or 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
First Steps | |
======================================================================================== | |
# Initialize git in a project | |
git init | |
# add and commit any existing files | |
git add . | |
git commit -m "Initial commit" | |
# associate with a remote repository | |
git remote add origin [email protected]/tschmidt/proposals.git | |
# push initial commit to remote | |
git push -u origin master | |
# create a new remote branch | |
git push origin master:refs/heads/develop | |
# create a local branch that is associated with a remote branch | |
git checkout -b develop --track origin/develop | |
Feature Branches | |
---------------------------------------------------------------------------------------- | |
# make sure develop branch is up-to-date | |
git checkout develop | |
git pull | |
# create feature branch based on the develop branch | |
git checkout -b feature-some-descriptive-name develop | |
# test, hack, hack, hack | |
git add . | |
git commit -m "Description of change" | |
# test, hack, hack, hack | |
git add . | |
git commit -m "Description of change" | |
# merge the feature back into the develop branch and remove feature branch | |
git checkout develop | |
git merge --no-ff feature-some-descriptive-name | |
git branch -d feature-some-descriptive-name | |
Release Branches | |
---------------------------------------------------------------------------------------- | |
# determine the next release number and create the branch. running `git tag' will | |
# show you the list of current tags | |
git checkout -b release-1.3 develop | |
# update the VERSION and HISTORY files. add and commit them. | |
git add . | |
git commit -m "Bumped version 1.3.0" | |
# merge into master | |
git checkout master | |
git merge --no-ff release-1.3 | |
git push origin master | |
# tag the commit | |
git tag -a 1.3.0 | |
git push --tags | |
# merge into develop | |
git checkout develop | |
git merge --no-ff release-1.3 | |
git push origin develop | |
# remove the release branch | |
git branch -d release-1.3 | |
Hotfix Branches | |
---------------------------------------------------------------------------------------- | |
# create hotfix branch | |
git checkout -b hotfix-squash-bug-x master | |
# hack, hack, hack | |
git add . | |
git commit -m "Commit message" | |
# update VERSION and HISTORY files and commit changes | |
git add . | |
git commit -m "[HOTFIX] Explanation of hotfix" | |
# merge the hotfix back into master | |
git checkout master | |
git merge --no-ff hotfix-squash-bug-x | |
git push origin master | |
# tag the hotfix | |
git tag -a 1.3.1 | |
git push --tags | |
# merge the hotfix into develop branch | |
git checkout develop | |
git merge --no-ff hotfix-squash-bug-x | |
# remove the hotfix branch | |
git branch -d hotfix-squash-bug-x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment