SRaj
SRaj

Reputation: 1338

Usage of git flow init when team members clone the remote repository

Suppose I have cloned a remote repository (which again belongs to me, say from github.com) and I have initialized git flow. As you may know, git flow init will create develop branch and create the prefixes for feature, bugfix etc. So far fine.

If I try to execute git flow init again on the same repository, git already says that: Already initialized for gitflow. To force reinitialization, use: git flow init -f

That means git stores the state of initialization within the git repository (in .git folder). Now, if I push the develop branch, it reflects in the remote repository, which is as expected.

Now, if another team member clones from this remote repository in his local machine, he again has to initialize using git flow init (if he wants to use git flow).

I expected that it should have given the output: Already initialized for gitflow. To force reinitialization, use: git flow init -f in his machine, but that is not the case.

Can you please clarify as to why every team member has to execute git flow init in his local machine after they clone from the remote repository?

Upvotes: 1

Views: 2533

Answers (1)

Yusef Maali
Yusef Maali

Reputation: 2431

The short answer is you need to initialize git flow after every git clone.

The initialization of git flow operates on two sides:

  1. create the correct branch structure (ex. the missing develop branch).
    You gonna need to push the new branch.

  2. update the local .git/config file with all the information given to git flow.
    This is a local configuration and cannot be pushed. After a successful git clone, the user needs to run a git flow init to allow git to update the local configuration.

You may found this reading useful: How can I share a git configuration?

Upvotes: 3

Related Questions