andy mccullough
andy mccullough

Reputation: 9601

Pull from Git repo once to that will be pushed to another repo

From reading docs, I cant seem to find / understand what I am looking for. I have some code in a git repository that I would like to use as a template / starting point for another project that will be pushed out to its own repository. How do I pull in code from a repo, a repo that will only ever be accessed once i.e. at this stage, that allows me to modify code and start pushing it out to another. I dont want to have an ongoing connection with the first repo as it will no longer be needed.

Upvotes: 0

Views: 22

Answers (1)

Jameson
Jameson

Reputation: 6679

I think you are overthinking matters. All you need to do is clone the code, optionally make some modifications, and then push it to another repo.

Anytime code is checked out from the second repository, it will not contain a reference to the original, but instead will have the remote origin pointing to your new repository.

If you really want to, you could even remove the origin remote from your project immediately after you first check it out.

This is as complicated as it could get, and needlessly:

git clone git://foo.tld/bar.git
git remote -v 
# shows origin

git remote remove origin
git remote -v
# shows none

git remote add baz git://baz.tld/potato.git
git push baz 
git remote -v
# shows only baz

For good measure, I'll throw in a link to the canonical reference on the matter, as well: Git SCM: Working With Remotes

Upvotes: 1

Related Questions