Is it possible to use Gitflow on top of a forking mindset? If so, how would you do things like create a local feature branch, push it to your origin and then pull request it? Would you pull request a branch to make it available to others? I'm especially interested in how this works with Atlassian Stash.
Thanks!
Stash developer here.
I think what Chris was getting at with his question is that technically forking, or not, should have no impact on gitflow. The feature/bugfix branches can either live in the main repository or on a fork. It doesn't, however, make sense for the release branches to really live in forks because it's not something you generally want to have diverging copies of (although you may well raise a bugfix pull request from a fork into a release branch).
Generally with features and bugfixes, if you're using either forking or just using branches in a single repository, then creating a pull request to the upstream repository is the best means of signalling your intent to merge into the dev/master branches, which then becomes an appropriate place for code review and conversation about the changes.
When you say 'collaborate' on a branch do you mean have multiple people working at the same time, or just code reviews. Assuming the former then there's nothing stopping you from having a personal fork where you have granted permissions to someone else and you either both push to the same branch, or you create pull requests between your forks, and then eventually back to the upstream repository. Whatever you like.
Specifically regarding Stash, there are some answers here which might give you an idea of how Stash interacts with GitFlow:
https://answers.atlassian.com/questions/220237/stash-branching-model-vs-git-flow
https://answers.atlassian.com/questions/165443/git-flow-with-stash
Just some food for thought on forking vs branches - the Stash team mostly uses a single repository with bugfix/feature branches. There are two reasons for this.
It makes having branch builds in Bamboo (or your CI of choice) much easier, at least for now. Bamboo can poll that repository, look for branches matching a regex and create a build for each one without any manual intervention. It gets a little more complicated with forks.
Visibility within the team - you can automatically see what people are working on without having to go to Stash or track each personal fork.
Forking is perfect when you don't have trust between two parties or need some form of enforced isolation, like open source. However, if you're in an organisation where you "trust" everyone on your team I would argue that having a single repository makes things much easier/streamlined. Just my 2c.
I hope that helps?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With