Skip to content

Instantly share code, notes, and snippets.

@ccnixon
Forked from peterdeweese/gitflow-tutorial.sh
Created October 30, 2015 16:30
Show Gist options
  • Save ccnixon/8fbc3c2c5959c9cf567d to your computer and use it in GitHub Desktop.
Save ccnixon/8fbc3c2c5959c9cf567d to your computer and use it in GitHub Desktop.
Gitflow Tutorial
set -o verbose
set -o errexit
echo '* Create and initialize a repository.'
git init gitflow-tutorial
cd gitflow-tutorial/
git flow init -d
echo '* Develop a Feature'
echo 'Make a feature branch.'
git flow feature start awesome-thing
echo 'Commit a change.'
touch file1.txt
git add .
git commit -m 'Implemented an awesome thing.'
echo 'Merge commits from develop and upstream.'
git rebase develop
# Manage conflicts by amending your commits if needed.
echo 'Merge the feature.'
git flow feature finish awesome-thing
echo '* Create a Release'
echo 'Start the release.'
git flow release start v1.0
echo 'Perform release specific changes.'
echo 'v1.0' > version.txt
git add .
git commit -m 'Added version file and set initial v1.0 version.'
echo 'Complete the release.'
git flow release finish -m 'v1.0' v1.0
echo '* Hotfix the release'
git flow hotfix start v1.0.1
echo 'v1.0.1/' > version.txt
git add .
git commit -m 'Updated version file to v1.0.1.'
git flow hotfix finish -m 'v1.0.1' v1.0.1
ffx-mb-024:tmp pdeweese$ ../gitflow-example/tutorial-local.sh
set -o errexit
echo '* Create and initialize a repository.'
* Create and initialize a repository.
git init gitflow-tutorial
Initialized empty Git repository in /Users/pdeweese/dev/examples/tmp/gitflow-tutorial/.git/
cd gitflow-tutorial/
git flow init -d
Using default branch names.
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
echo '* Develop a Feature'
* Develop a Feature
echo 'Make a feature branch.'
Make a feature branch.
git flow feature start awesome-thing
Switched to a new branch 'feature/awesome-thing'
Summary of actions:
- A new branch 'feature/awesome-thing' was created, based on 'develop'
- You are now on branch 'feature/awesome-thing'
Now, start committing on your feature. When done, use:
git flow feature finish awesome-thing
echo 'Commit a change.'
Commit a change.
touch file1.txt
git add .
git commit -m 'Implemented an awesome thing.'
[feature/awesome-thing e0e80fd] Implemented an awesome thing.
0 files changed
create mode 100644 file1.txt
echo 'Merge commits from develop and upstream.'
Merge commits from develop and upstream.
git rebase develop
Current branch feature/awesome-thing is up to date.
# Manage conflicts by amending your commits if needed.
echo 'Merge the feature.'
Merge the feature.
git flow feature finish awesome-thing
Switched to branch 'develop'
Updating 8183c4a..e0e80fd
Fast-forward
0 files changed
create mode 100644 file1.txt
Merge branch 'release/v1.0'
Deleted branch feature/awesome-thing (was e0e80fd).
Summary of actions:
- The feature branch 'feature/awesome-thing' was merged into 'develop'
- Feature branch 'feature/awesome-thing' has been removed
- You are now on branch 'develop'
Merge branch 'release/v1.0' into develop
echo '* Create a Release'
* Create a Release
echo 'Start the release.'
Start the release.
git flow release start v1.0
Switched to a new branch 'release/v1.0'
Summary of actions:
- A new branch 'release/v1.0' was created, based on 'develop'
- You are now on branch 'release/v1.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 'v1.0'
echo 'Perform release specific changes.'
Perform release specific changes.
echo 'v1.0' > version.txt
git add .
git commit -m 'Added version file and set initial v1.0 version.'
[release/v1.0 e96eab1] Added version file and set initial v1.0 version.
1 file changed, 1 insertion(+)
create mode 100644 version.txt
echo 'Complete the release.'
Complete the release.
git flow release finish -m 'v1.0' v1.0
Switched to branch 'master'
Merge made by the 'recursive' strategy.
version.txt | 1 +
Merge branch 'hotfix/v1.0.1'
1 file changed, 1 insertion(+)
create mode 100644 file1.txt
create mode 100644 version.txt
Switched to branch 'develop'
Merge branch 'hotfix/v1.0.1' into develop
Merge made by the 'recursive' strategy.
version.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 version.txt
Deleted branch release/v1.0 (was e96eab1).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged 'v1.0'
- Release branch has been back-merged into 'develop'
- Release branch 'release/v1.0' has been deleted
echo '* Hotfix the release'
* Hotfix the release
git flow hotfix start v1.0.1
Switched to a new branch 'hotfix/v1.0.1'
Summary of actions:
- A new branch 'hotfix/v1.0.1' was created, based on 'master'
- You are now on branch 'hotfix/v1.0.1'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish 'v1.0.1'
echo 'v1.0.1/' > version.txt
git add .
git commit -m 'Updated version file to v1.0.1.'
[hotfix/v1.0.1 527873b] Updated version file to v1.0.1.
1 file changed, 1 insertion(+), 1 deletion(-)
git flow hotfix finish -m 'v1.0.1' v1.0.1
Switched to branch 'master'
Merge made by the 'recursive' strategy.
version.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Switched to branch 'develop'
Merge made by the 'recursive' strategy.
version.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Deleted branch hotfix/v1.0.1 (was 527873b).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged 'v1.0.1'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/v1.0.1' has been deleted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment