Difference between revisions of "Git-flow"
| Line 88: | Line 88: | ||
Version tag prefix? [] | Version tag prefix? [] | ||
Hooks and filters directory? [/workspace/git-flow-helloworld/.git/hooks] | Hooks and filters directory? [/workspace/git-flow-helloworld/.git/hooks] | ||
| + | </source> | ||
| + | |||
| + | ==Features== | ||
| + | |||
| + | * Develop new features for upcoming releases | ||
| + | * Typically exist in developers repos only | ||
| + | |||
| + | ===Start a new feature=== | ||
| + | |||
| + | Development of new features starting from the 'develop' branch. | ||
| + | |||
| + | Start developing a new feature with | ||
| + | |||
| + | <source> | ||
| + | $ git flow feature start MYFEATURE | ||
| + | </source> | ||
| + | |||
| + | This action creates a new feature branch based on 'develop' and switches to it | ||
| + | |||
| + | as an example | ||
| + | <source> | ||
| + | $ git flow feature start my-first-gitflow | ||
| + | Switched to a new branch 'feature/my-first-gitflow' | ||
| + | |||
| + | Summary of actions: | ||
| + | - A new branch 'feature/my-first-gitflow' was created, based on 'develop' | ||
| + | - You are now on branch 'feature/my-first-gitflow' | ||
| + | |||
| + | Now, start committing on your feature. When done, use: | ||
| + | |||
| + | git flow feature finish my-first-gitflow | ||
| + | |||
| + | (base) Rasims-MacBook-Pro:git-flow-helloworld $ git branch | ||
| + | develop | ||
| + | * feature/my-first-gitflow | ||
| + | master | ||
| + | </source> | ||
| + | |||
| + | ===Finish up a feature=== | ||
| + | |||
| + | Finish the development of a feature. This action performs the following | ||
| + | |||
| + | * Merges MYFEATURE into 'develop' | ||
| + | * Removes the feature branch | ||
| + | * Switches back to 'develop' branch | ||
| + | |||
| + | <source> | ||
| + | $ git flow feature finish MYFEATURE | ||
| + | </source> | ||
| + | |||
| + | |||
| + | as an example for our hello-world repo | ||
| + | |||
| + | <source> | ||
| + | # make some changes on the feature branch and push | ||
| + | $ git add . | ||
| + | $ git commit -m 'commıt feature branch changes' | ||
| + | $ git push | ||
| + | |||
| + | # git flow finish | ||
| + | $ git flow feature finish my-first-gitflow | ||
| + | |||
| + | Switched to branch 'develop' | ||
| + | Updating 5a49e29..cd4345e | ||
| + | Fast-forward | ||
| + | README.md | 2 ++ | ||
| + | 1 file changed, 2 insertions(+) | ||
| + | To https://github.com/xxxx/git-flow-helloworld.git | ||
| + | - [deleted] feature/my-first-gitflow | ||
| + | Deleted branch feature/my-first-gitflow (was cd4345e). | ||
| + | |||
| + | Summary of actions: | ||
| + | - The feature branch 'feature/my-first-gitflow' was merged into 'develop' | ||
| + | - Feature branch 'feature/my-first-gitflow' has been locally deleted; it has been remotely deleted from 'origin' | ||
| + | - You are now on branch 'develop' | ||
</source> | </source> | ||
Revision as of 11:46, 12 April 2020
official resource :
https://danielkummer.github.io/git-flow-cheatsheet/
Contents
What is git-flow
git-flow are a set of git extensions to provide high-level repository operations for Vincent Driessen's branching model.
This document shows the basic usage and effect of git-flow operations.
Basic tips
- Git flow provides excellent command line help and output. Read it carefully to see what's happening...
- The macOS/Windows Client Sourcetree is an excellent git gui and provides git-flow support
- Git-flow is a merge based solution. It doesn't rebase feature branches.
Installation
You need a working git installation as prerequisite. git
Git flow works on macOS, Linux and Windows
macOS
$ brew install git-flow-avh$ port install git-flow-avhLinux
$ apt-get install git-flow
Windows (Cygwin)
$ wget -q -O - --no-check-certificate https://raw.github.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh install stable | bashYou need wget and util-linux to install git-flow.
Hello World with git-flow
Git flow needs to be initialized in order to customize your project setup.
Create new git repo
$ mkdir git-flow-helloworld
$ cd git-flow-helloworld
$ echo "# git-flow helloworld" >> README.md
$ git init
$ git add README.md
$ git commit -m "git-flow first commit"
$ git remote add origin https://github.com/[git account username]/git-flow-helloworld.git
$ git push -u origin masterInitialize git-flow
Start using git-flow by initializing it inside an existing git repository:
$ git flow initYou'll have to answer a few questions regarding the naming conventions for your branches. It's recommended to use the default values.
$ git flow init
Which branch should be used for bringing forth production releases?
- master
Branch name for production releases: [master]
Branch name for "next release" development: [develop] develop
How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [/workspace/git-flow-helloworld/.git/hooks]Features
- Develop new features for upcoming releases
- Typically exist in developers repos only
Start a new feature
Development of new features starting from the 'develop' branch.
Start developing a new feature with
$ git flow feature start MYFEATUREThis action creates a new feature branch based on 'develop' and switches to it
as an example
$ git flow feature start my-first-gitflow
Switched to a new branch 'feature/my-first-gitflow'
Summary of actions:
- A new branch 'feature/my-first-gitflow' was created, based on 'develop'
- You are now on branch 'feature/my-first-gitflow'
Now, start committing on your feature. When done, use:
git flow feature finish my-first-gitflow
(base) Rasims-MacBook-Pro:git-flow-helloworld $ git branch
develop
* feature/my-first-gitflow
masterFinish up a feature
Finish the development of a feature. This action performs the following
- Merges MYFEATURE into 'develop'
- Removes the feature branch
- Switches back to 'develop' branch
$ git flow feature finish MYFEATURE
as an example for our hello-world repo
# make some changes on the feature branch and push
$ git add .
$ git commit -m 'commıt feature branch changes'
$ git push
# git flow finish
$ git flow feature finish my-first-gitflow
Switched to branch 'develop'
Updating 5a49e29..cd4345e
Fast-forward
README.md | 2 ++
1 file changed, 2 insertions(+)
To https://github.com/xxxx/git-flow-helloworld.git
- [deleted] feature/my-first-gitflow
Deleted branch feature/my-first-gitflow (was cd4345e).
Summary of actions:
- The feature branch 'feature/my-first-gitflow' was merged into 'develop'
- Feature branch 'feature/my-first-gitflow' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'develop'