0

If I want to clone/fork/work off of project A on a new project, B, what would be the best approach?

My current idea is to do this:

  • Clone repository A, and create two remotes. The first, a meaningful name pointing to the repository URL of repository A, and the second, origin, which points to repository B.

The reason I want to do this is so that repository B can have repository A as a base, and any time changes are made to repository A that I want to merge in, I can just git pull <repository-A-remote-name> <branch> and when I want to push to repository B I just push to origin.

Has anyone ever had this sort of workflow before, and if so would you say that this is a good approach, or have you tried something else?

Note: pull requests on GitHub are not necessary here because project A never needs the changes of project B, but project B will always need to merge in updates to project A.

Lansana Camara
  • 9,497
  • 11
  • 47
  • 87
  • 1
    Forking is basically the same as cloning. `Forking` is just a more fancy name 'invented' by github. So 1. and 2. are identical. See [here](http://stackoverflow.com/questions/6286571/are-git-forks-actually-git-clones) – ckruczek Mar 08 '17 at 12:43
  • 1
    Clone if you own the github, fork and then clone the fork if you don't. – AAM111 Mar 08 '17 at 12:43
  • Ah good points. Repository A and B are owned by me. Question updated. :) – Lansana Camara Mar 08 '17 at 12:47

1 Answers1

1

This is pretty much the same. The only difference is, the fork-relation in GitHub. Forking in GitHub just creates a clone of the repo under your user and maintains a parent-fork relation between the two. If you want your fork to be shown as fork of the parent in your fork and in the parent and / or want to post pull-requests, that do a fork. If you don't want this relation to be shown, and don't want to post PRs, then simply clone and push to your account as new repo.

Having a remote upstream for A and a remote origin for your own repo and regularly integrating upstream changes into your repo is pretty common workflow, indepdently from GitHub at all. (Names are freely choosable of course)

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • Updated my comment in regards to your first paragraph. And thanks a lot for the second, just wanted to make sure I was going about this in a good, practical way that is done by others and seen as a good practice. – Lansana Camara Mar 08 '17 at 12:49