简体   繁体   中英

Git - template repo pull into new repo

I have a template project set-up that I use for a lot of projects as a starting point. It has lot of custom code for various things. (It's php not that this really matters). Normally I'd just copy this template project into a new folder and begin working on an actual project. This actual project would then be in a git repo.

Now I want to start storing my template project in a git repo, so I can track changes better and try things out in branches. What's the best way of going about this so that I could have repos for actual projects that could use this template?
I thought about composer with a private repo, but this situation could also apply to some iOS templates I have. I could obviously then use Pods etc. for the iOS stuff, but is there a way to do this simply in Git?
IE have repos that reference another repo, but when I commit the actual project it doesn't have an effect on the template?

IE have repos that reference another repo, but when I commit the actual project it doesn't have an effect on the template?

The simplest way is to clone your template repo, and then replace the remote ' origin ' with the url of a new empty repo:

git clone /url/to/template mynewrepo
cd mynewrepo
git remote set-url origin /url/of/new/empty/repo
git push -u origin master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM