Skip to content

Instantly share code, notes, and snippets.

@kevinold
Created August 19, 2010 16:45
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kevinold/538326 to your computer and use it in GitHub Desktop.
Save kevinold/538326 to your computer and use it in GitHub Desktop.
testing git-flow on existing git repo
# In reply to my own question
# (http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/#comment-69995567)
# about using git-flow with existing git repos I experimented with a dummy
# git repo and it appears rather straight-forward
kold@Macintosh-27 $ git init test_git_flow
Initialized empty Git repository in /private/tmp/test_git_flow/.git/
(/tmp)
kold@Macintosh-27 $ cd test_git_flow/
(/tmp/test_git_flow)
kold@Macintosh-27 $ ls
(/tmp/test_git_flow)
kold@Macintosh-27 $ git log
fatal: bad default revision 'HEAD'
(/tmp/test_git_flow)
kold@Macintosh-27 $ touch test.txt test2.txt
(/tmp/test_git_flow)
kold@Macintosh-27 $ ls
test.txt test2.txt
(/tmp/test_git_flow)
kold@Macintosh-27 $ git add .
(/tmp/test_git_flow)
kold@Macintosh-27 $ git ci -am 'initial commit'
[master (root-commit) 43a4de1] initial commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt
create mode 100644 test2.txt
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git co -b newdesign
Switched to a new branch 'newdesign'
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign]$ cd
(~)
kold@Macintosh-27 $ cd -
change on newdesign branch
/tmp/test_git_flow
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign]$ git st
# On branch newdesign
nothing to commit (working directory clean)
kold@Macintosh-27 [newdesign]$ ls
test.txt test2.txt
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign]$ vi test2.txt
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign*]$ git ci -am 'add text'
[newdesign 0c212e6] add text
1 files changed, 1 insertions(+), 0 deletions(-)
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign]$ git co
(/tmp/test_git_flow)
kold@Macintosh-27 [newdesign]$ git co -
Switched to branch 'master'
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git flow init
Which branch should be used for bringing forth production releases?
- master
- newdesign
Branch name for production releases: [master]
Which branch should be used for integration of the "next release"?
- newdesign
Branch name for "next release" development: [master] develop
Local branch 'develop' does not exist.
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git flow init
Which branch should be used for integration of the "next release"?
- newdesign
Branch name for "next release" development: [master] develop
Local branch 'develop' does not exist.
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br develop
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br
develop
* master
newdesign
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git flow init
Which branch should be used for integration of the "next release"?
- develop
- newdesign
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? []
(/tmp/test_git_flow)
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git flow feature
No feature branches exist.
You can start a new feature branch:
git flow feature start <name> [<base>]
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git st
# On branch master
nothing to commit (working directory clean)
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br
develop
* master
newdesign
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br -m newdesign feature/newdesign
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br
develop
feature/newdesign
* master
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git flow feature
newdesign
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$ git br -av
develop 43a4de1 initial commit
feature/newdesign 0c212e6 add text
* master 43a4de1 initial commit
(/tmp/test_git_flow)
kold@Macintosh-27 [master]$
@bobwolff68
Copy link

Saw a link to this post for existing repos and git flow. THANKS! I have also seen that it is necessary to at least do a:
$ git push origin develop
This from the gitflow page itself (due to a comment)...

So, do you also do:
$ git push origin (each of the branch names release,hotfixes,feature,support) ??

@kevinold
Copy link
Author

I don't really push any of the release, hotfixes, feature, etc. branches, but you could. They're just regular git branches with prefix for git-flow to use.

@bobwolff68
Copy link

Ahh - I get it now. Cool. Thanks Kevin.

@EnriqueDev
Copy link

Very useful, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment