Felipe Salazar
Felipe Salazar

Reputation: 25

How to version control a cloned repository?

I am kind of new in cloning existing repositories from github to start my own projects, for example using a starting template for any framework.

My question is how should I version this cloned repos if they already have a .git folder with their history and remote origin. For instance I tried to set a new origin using git remote add origin my/own/remote/repo but I got the following message: fatal: remote origin already exists.

I always read on project's website that the correct way to start using their code is cloning the repo, so how is the best way to go if i'm using their project as a start point of mine?

btw, this is the project repository https://github.com/roots/roots. but is more a general question.

Upvotes: 0

Views: 127

Answers (2)

Mykola Gurov
Mykola Gurov

Reputation: 8685

There are two ways you may chose: keep the original history of the cloned project or erase it.

If you keep the history of the "framework template", you may sometimes merge interesting changes to your project. You will probably want to rename the origin when doing clone: git clone --origin framework_template ... will give the original remote a different name, framework_template in the example. You may then add your projects's github repo as git remote add origin ....

If you prefer to forget about the "framework template" history, all you have to do is to erase the git's internal folder and re-initiate a new git repository:

git clone http://repo workdir
cd workdir
rm -Rf .git
git init .

Upvotes: 1

Austen Payan
Austen Payan

Reputation: 11

When you are viewing a Github repo, at the top right there is a fork button.

You are going to want to fork their repository, and then clone your forked repo to work with.

Upvotes: 0

Related Questions