best practice on sharing feature branches between developers

1,276 views
Skip to first unread message

Callixte.

unread,
Mar 27, 2012, 3:32:24 PM3/27/12
to gitflow-users
Hi there,

I have been reading quite a lot of resources out there and have also
been experimenting on my own, but I couldn't figure out what is the
best way to do so.
Here is the scenario implying Alice and Bob working together on the
same feature:
Alice starts the feature branch:
git flow feature start blah
she does some work there
...
git commit -am "did some work"
Bob steps in. At this stage, I see two possibilities:
1/ local branches
Bob pulls the branch from Alice
git flow feature pull alice blah
He does some work
...
git commit -am "fixing some issues"
Alice to pull the branch from him to get his changes
git flow feature pull bob blah
2/ remote branches
Alice needs to publish the branch
git flow feature publish blah
Bob can then track and checkout the branch
git flow feature track blah
git flow feature checkout blah
He can work
...
git commit -am "fixing some issues"
He pushes his changes
git push
Alice can get them
git pull
or
git flow feature pull origin blah

Which is best to go with?

I am also wondering about the finish.
At the end Alice finishes the branch to have it merge to develop.
git flow feature finish blah
But then, the branches still exist on origin and an Bob's machine. How
do we get rid of them?

Thanks.

Dan

unread,
Jun 30, 2012, 9:55:52 AM6/30/12
to gitflo...@googlegroups.com
As long as all team members can pull from everybody else's local repo then opt 1 is fine, but if you have some team members who can't pull directly then you should go with option 2. Perhaps some on your team is in a remote location, firewalled, etc, but they do have access to a central server, then to be consistent, you should share branches via a central origin repo instead of direct pulls from developers local repos. If you try to use both options at the same time for different developers then things will get confusing.

For deleting branches after finishing a release or hotfix. Just make sure Bob's repo has pulled from Alice (or from origin after Alice pushed to origin) so the latest commits and has the merge with the master and develop branches, Bob can simply delete a that feature branch, as in:
   git branch -d blah

You can also delete the branch on the origin repository if needed:
   git push origin :feature/blah

Note the empty space before the colon; that indicates you are pushing nothing to the origin's feature/blah branch, effectively deleting it.
Reply all
Reply to author
Forward
0 new messages