A flow based on this article
AR: my comments will start with four hashes
# let's update master with the latest changes from the remote
git checkout master
git pull --rebase origin master
#### AR: A general comment. You shouldn't have any unpublished commits on your local master branch.
#### AR: If you do, you will accidentely push them when pushing the finished feature branch.
#### AR: That's why I would just do git fetch here, or just do git pull, without the --rebase
#### AR: switch, to make it clear. I probably wouldn't bother with a local master at all
#### AR: (or add some comment saying that you assume it's always without unpublished commits).
# 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 --tags origin master
git branch -d feature/awesome
git push origin --delete feature/awesome
#### AR: you're not tagging anything here, so no need for the --tags switch to git push
# let's cut a release
git checkout master
# note we don't update master, since this is the point we've decided to base our release on
# Start work on the release branch
git checkout -b release/1.0.0
#### AR: I would simplify the description to something like:
#### AR: 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 master
#### AR: I believe this should be: git push --tags origin release/1.0.0 (you didn't update master)
# 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
git checkout master
git pull --rebase 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 --tags origin master
git branch -d feature/awesome
git push origin --delete feature/awesome
# let's cut a release
git checkout master
# note we don't update master, since this is the point we've decided to base our 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 master
# 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 release/1.0.0 # no conflicts here
# push to origin, remove branches
git push --tags origin master
git branch -d release/1.0.0
git push origin --delete release/1.0.0
#### AR: No No No No No. You cannot rebase neither release nor hotfix branches.
#### AR: If you do, you will either publish the current master, instead of just the
#### AR: release/hotfix work, or have duplicate commits in your repository (and weird
#### dead-end branches for each release/hotfix). This always has to be done with a merge.