Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git flow and Github

I am struggling to understand how Git flow works with Github.

Github allows the fork/pull request model of integrating changes, where the entire upstream repo and all its branches are copied into the fork.

Then using git flow, I would branch off of a dev branch say and then when finished my changes would be merged into the dev branch of my fork not the upstream. So when a pull request is made back the upstream repo, it merges dev(fork) to dev(upstream) but this loses all knowledge of my feature branch etc ever existed.

So for Git flow to work properly, would I need to stop forking the repo and create feature branches directly in the upstream repo?

So fork/pull should be kept separate from git flow?

like image 467
jon lee Avatar asked Jan 21 '15 10:01

jon lee


People also ask

What is Git flow and GitHub flow?

GitHub proposes an alternate workflow called GitHub Flow. GitHub Flow has some of the same elements as Git Flow, such as feature branches. But unlike Git Flow, GitHub Flow combines the mainline and release branches into a “master” and treats hotfixes just like feature branches.

Does GitHub still use GitHub flow?

The GitHub flow is useful for everyone, not just developers. For example, here at GitHub, we use GitHub flow for our site policy, documentation, and roadmap.

What is the difference between Gitflow and flow GitHub?

Unlike Git-Flow, GitHub-Flow involves no release branches. In the ideas of GitHub-Flow, once a version is ready to go, it can be deployed. Similarly, GitHub-Flow believes that hotfixes are identical to minor feature changes, and their processing methods should be similar.


1 Answers

So fork/pull should be kept separate from git flow?

Yes:

  • one (Gitflow) is a merge workflow (what to merge from where to where)
  • the other (GitHub fork/pull request) is a publication workflow (what to push and where)

The Atlassian tutorial on workflows has therefore two sections:

  • one for gitflow

gitflow

  • one for forking workflow

forks workflow

Just want to know whether git-flow should be used in the upstream or a fork.
It's not making sense to me to use git-flow in a fork as you lose all the info when merging back into the upstream repo

Exactly: trying to merge the two workflows doesn't make sense as both are used for different need:

  • gitflow: common access to a blessed Git repo, where all the developers can push to (and must agree on the branch and merge convention)
  • forking workflow: no access to one common repo, hence the need for a fork (a repo which one developer owns and can push to), with asynchronous contributions back to the original repo through pull requests.
like image 130
VonC Avatar answered Sep 28 '22 18:09

VonC