Git Flow

Using git flow -- or not

Developing features

$ git flow feature start my-feature
Switched to a new branch 'feature/my-feature'

Summary of actions:
- A new branch 'feature/my-feature' was created, based on 'develop'
- You are now on branch 'feature/my-feature'

Now, start committing on your feature. When done, use:

     git flow feature finish my-feature

Develop your feature, committing your code as necessary.

$ git commit -am "Pithy commit message"
[feature/my-feature 48b1b6c] Pithy commit message
 1 file changed, 1 insertion(+)

We can now see that we are ready to `finish` our feature development:

$ git status
On branch feature/my-feature
nothing to commit, working directory clean

Finish it!

$ git flow feature finish my-feature
Switched to branch 'develop'
Updating dcf1bfe..48b1b6c
Fast-forward
 test.txt | 1 +
 1 file changed, 1 insertion(+)
Deleted branch feature/my-feature (was 48b1b6c).

Summary of actions:
- The feature branch 'feature/my-feature' was merged into 'develop'
- Feature branch 'feature/my-feature' has been removed
- You are now on branch 'develop'

Releasing

Before releasing it is wise to check for the existence of known tags so we know what to name our release:

$ git fetch --tags

Start

$ git flow release start 1.0
Switched to a new branch 'release/1.0'

Summary of actions:
- A new branch 'release/1.0' was created, based on 'develop'
- You are now on branch 'release/1.0'

Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:

     git flow release finish '1.0'

The very first thing you need to do is to update the version in your README file. Do it, do it now by opening the README and creating a new entry for this version (unless you can fill in the details as well):

#### 1.0 - 2015-08-31
* Initial commit

Commit this using an appropriate commit message:

$ git commit -am "Bumped version number to 1.0"

Make any last minute updates/changes. NO FEATURE DEVELOPMENT!

$ git flow release finish 1.0
Switched to branch 'main'
Merge made by the 'recursive' strategy.
 test.txt | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 test.txt
Switched to branch 'develop'
Merge made by the 'recursive' strategy.
 test.txt | 1 -
 1 file changed, 1 deletion(-)
Deleted branch release/1.0 (was 640d145).

Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'main'
- The release was tagged '1.0'
- Release branch has been back-merged into 'develop'
- Release branch 'release/1.0' has been deleted

Finally, update the remotes

$ git push origin main
$ git push origin develop
$ git push --tags

Hotfixes

When you need to make a fix that is on a live version.

$ git flow hotfix start 1.0.1
Switched to a new branch 'hotfix/1.0.1'

Summary of actions:
- A new branch 'hotfix/1.0.1' was created, based on 'main'
- You are now on branch 'hotfix/1.0.1'

Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:

     git flow hotfix finish '1.0.1'

Update the README file and commit:

$ git commit -am "Bumped version number to 1.0.1"

Fix the issue and commit those changes.

$ git commit -am "Fixed major issue with site!"

Finish the hotfix:

$ git flow hotfix finish 1.0.1
Switched to branch 'develop'
Merge made by the 'recursive' strategy.
 test.txt | 1 +
 1 file changed, 1 insertion(+)
Deleted branch hotfix/1.0.1 (was d923720).

Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'main'
- The hotfix was tagged '1.0.1'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/1.0.1' has been deleted

Finally, update the remotes

$ git push origin main
$ git push origin develop
$ git push --tags