A flow based on this article
Comments from Adam on the original version of this gist can be found here
# let's update master with the latest changes from the remote
# to be safe, make sure you have no unpublished commits on the local master
git checkout master
git pull origin master
# Start work on a feature branch
git checkout -b feature/awesome
# implement awesome feature (feature 1, for example)
# commit changes
git add -A
git commit -m "add feature 1"
# ok i'm done with this feature branch, let's merge back to master
# first update master with latest changes from the remote
git checkout master
git pull --rebase origin master
# then merge the feature branch
git merge feature/awesome # deal with any merge conflicts here
# push to origin, remove branches
git push origin master
git branch -d feature/awesome
git push origin --delete feature/awesome
# let's cut a release
git checkout master
# Start work on the release branch
git checkout -b release/1.0.0 <the-commit-you-want-your-release-on>
# bump versions, add changelog, etc
# commit changes
git add -A
git commit -m "Release 1.0.0"
# tag the release and push it to the remote
git tag 1.0.0
git push --tags origin release/1.0.0
# now we merge back to master
# first update our master from the remote
git checkout master
git pull --rebase origin master
# then do the actual merge
git merge release/1.0.0 # deal with merge conflicts here
# push to origin, delete release branch
git push --tags origin master
git branch -d release/1.0.0
git push origin --delete release/1.0.0
# let's update master with the latest changes from the remote
# to be safe, make sure you have no unpublished commits on the local master
git checkout master
git pull origin master
# Start work on a feature branch
git checkout -b feature/awesome
# implement awesome feature (feature 1, for example)
# commit changes
git add -A
git commit -m "add feature 1"
# ok i'm done with this feature branch
# let's update from master by rebasing
git fetch origin
git rebase -i origin/master # deal with conflicts here
git checkout master
git pull --rebase origin master
# then merge the feature branch
git merge --no-ff feature/awesome # no conflicts here
# push to origin, remove branches
git push origin master
git branch -d feature/awesome
git push origin --delete feature/awesome
# let's cut a release
git checkout master <the-commit-you-want-your-release-on>
# Start work on the release branch
git checkout -b release/1.0.0
# bump versions, add changelog, etc
# commit changes
git add -A
git commit -m "Release 1.0.0"
# tag the release and push it to the remote
git tag 1.0.0
git push --tags origin release/1.0.0
# now we merge back to master
# first update our master from the remote
git checkout master
git pull --rebase origin master
# then do the actual merge
git merge release/1.0.0 # deal with merge conflicts here
# push to origin, delete release branch
git push --tags origin master
git branch -d release/1.0.0
git push origin --delete release/1.0.0