How do I use a Github project as the basis for a new one?

Asked

Viewed 424 times

6

I’m trying to use the angular-phonecat as a basis for a new project, and make modifications on top of it, because the structure is very similar to what I want to develop and so I wouldn’t have to configure and download everything I need(npm, Bower). But every time I create a new repository, it looks like a copy of the original repository and I can’t commit my modifications to my project. What am I doing:

  • Fork of the angular-phonecat project
  • Clone of my Fork
  • I create a new repository on Github
  • I change the origin: git remote set-url origin git://github.com/meu-repositorio-criado
  • git fetch --prune (I researched that it erases the branches, but it didn’t work for what I want)
  • git push

After the push, the new repository project is the same as the angular-phonecat origial and I can’t send my commits. What to do? I want my project to be independent, only with the 'skeleton' of the other.

1 answer

3


Do the following.

Clone the project and delete the folder .git then so that it doesn’t keep Git information after being cloned:

git clone https://github.com/camilaavilarinho/angular-phonecat.git [nome-do-projeto] && rm -rf [nome-do-projeto]/.git

Create a repository for this new repository on Github. And then, tell your project which path to the remote repository (the one you just created):

git remote add origin [novo-caminho-do-projeto]

After that, just commit and upload the changes, you will no longer modify the original project.

  • This --Bare option is taking other files (hook, info, Objects...) and not the project files (app, e2e-tests, scripts...)

  • Sorry, it’s true, I had a wrong knowledge of the option --bare. I changed the answer so it works for what you need. :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.