Wednesday 22 July 2015

Git Flow for Feature Management


1. Installazation
$ brew install git-flow

2. Check out a remote repo
$ git clone https://github.com/project.git

List the branches under the repo
$ git branch -a

Check out the develop branch
$ git checkout -b develop origin/develop

3. Initialize it inside an existing git repository
$ git flow init

4. Create a new feature branch based on 'develop' and switches to it for developing
$ git flow feature start newfeature

5. Add a new file, commit to feature
$ git add test.txt
$ git commit -a -m "message"

Note: if use "git commit -m", may return error "Changes not staged for commit"
Git has a "staging area" where files need to be added before being committed

6. Publish a feature to the remote server
$ git flow feature publish newfeature

7. Repeate (5), then push changes to the remote feature
$ git push origin feature/newfeature

Create Pull Request on github page (select 'develop' as base), for people review.

8. Finish a feature and merge newfeature into 'develop'; automatically remove the feature branch in local
$ git flow feature finish newfeature


9. Push local develop to remote server
$ git push origin develop

From Github, click on "Merge pull request" to remove feature branch

10. Get a published feature
$ git flow feature pull origin newfeaturename

11. Create a release branch from 'develop' branch.
$ git flow release start newrelease

12. Publish the release branch.
$ git flow release publish newrelease

13. Finish a release: merge the release branch into 'master';
tags the release with its name; back-merges the release into 'develop';
Removes the release branch

$ git flow release finish newrelease
$ git push --tags

Reference:

No comments:

Post a Comment