How to start working on a Project based on a Repository without losing the connection

How to start working on a Project based on a Repository without losing the connection
0
#1

Hello,

What i have:

  • NodeJS Authentication Template on Github

What i want to achieve:

  • Use the Template as the base of a new Project, however I want to be able to keep working on the template and pull the changes into the new Project --> Like a dependency.

What i tried:

  • Clone and creating a new Repo --> doesn’t work since i loose the connection to the Template Repository
  • I have read various Threads on Stack overflow but it just doesn’t seem possible?

My current Solution:

  • I use a branch inside of the template Repo; however, this is not what i want, since everyone who clones the template automatically also pulls my branch

Thanks for your help

#2

You can fork a project and update it with changes to the original stream.

#3

If I understand your question, you want to clone a template, make a project out of it, but also make changes to the template as you go and push only those changes to the template repo. This doesn’t really make logical sense: you are going to make changes to the template for your repo, such as adding dependencies, editing the entry point (e.g. index.js) and so forth, and there’s really no way to differentiate these changes from changes to your template. Your project repo needs to lose the connection to the template repo, and any changes you make to the template will need to be done “by hand”. Even if you maintain your project in a separate branch, this would still be the case.

You might be able to cherry-pick changes from the project repo to the template repo, but this isn’t much better than doing it by hand.

#4

Not exactly what i meant. I don’t want to push to the template from my new project. I only want to pull changes i make to the template to the new project.

Maybe template isn’t the best way to describe it tho, since as a user of the template the only changes you’re going to make is the config file and nothing else (and that file is obviously ignored by git)

#5

Pulling changes from the template makes more sense, but unfortunately it’s basically the same problem with histories – the project has to maintain independence from the template, otherwise the template’s history will become tangled with the project. Since you never touch the template files in your project, you could write a script that pulls changes from the template into a temporary checkout, then copies over the template files into the project repo, overwriting the old ones (you might want to have it make backups just in case local changes were made). This is pretty much what I do with my dotfiles repo.

#6

Ok, unlucky that there is no cleaner method to do this! Thanks for you help tho!

#7

Yeah I would suggest what Chuck said basically…

  • Run script to download (not pull) from template repo and replace files in working directory
  • test and see that everything is fine
  • commit

I suppose branching then merging or rebasing to make the update may be good depending on your needs.