Lets say I\'ve created a new feature with git flow feature start FEATURENAME
then published it with git flow feature publish FEATURENAME
This answer by brainimus illustrates the collaborative aspect of a feature branch, using the GitHub pull request aspect which facilitates the code review and discussion part:
- Create a feature branch:
git flow feature start module_1
- The code is updated on the feature branch
- As changes are committed they are pushed to GitHub (or once at the end if preferred)
- When the feature is completed a pull request is opened in GitHub comparing
develop
and the feature branchmodule_1
- The team reviews the pull request and makes comments
- Any changes from the pull request are made to the feature branch
- Once all changes are incorporated on the feature branch the feature branch is finished:
git flow feature finish module_1
- The
develop
branch is pushed to GitHub (GitHub will automatically mark the pull request as closed/merged when this happens)
That leaves the issue of closing that branch though:
Who ever runs
git flow feature finish module_1
will have the luxury of their local feature branch being deleted but anyone else who checked out the branch with have to do this manually if they want to
I would recommend a git fetch --prune
, especially since Git 1.8.5 you can set that "prune" step in your config: a simple git fetch will remove your feature branch if it has been deleted on the server side (by someone else making a git flow feature finish
)
The gitflow feature track if the AVH edition simply checkout and track the branch, that is make sure the local branch becomes a local tracking branch, with an upstream branch (a remote tracking branch) associated to it.
That is, it sets up branch.<name>.remote
and branch.<name>.merge
.
If you do a git flow feature pull
(for a new local feature branch), but meant actually git flow feature track
, all you would need to do would be to make your existing branch track the upstream one:
git branch -u origin/feature
Generally:
git flow feature track
, git flow feature pull
git flow feature checkout
As mention in "Getting Started – Git-Flow":
git flow feature pull
This will be done when more than one person works on a feature together.
You should use this command if you want to do a pull on the remote feature branch as follows:
git flow feature pull [alias] [featureName]
By using this command you’ll get the source code that has been pushed by your team mates and their changes will be automatically merged into your local branch.
If there are conflicts you will be the unlucky or lucky one to do the resolutions of these conflicts.
Sounds like you are using git flow feature pull
, where you should be using git flow feature track
, since that does create a local branch that tracks the remote.
I can't really think of why I'd ever use git flow feature pull
. It creates a local branch with no tracking set up on it, and I don't know why that would be useful! It's also badly named, since a pull should involve a merge, and this does not.