I have some basic git knowledge but I'm not sure how to accomplish this.
I am trying to clone (?) github WordPress starter theme underscores. The idea is to create a basic framework based (with some modifications) on that repository. Then create other themes with that framework as the base.
So it should look something like:
copy github underscores repository to local
create a local repository my_framework from the underscores one, modifying certain parts of those files always (such as the name) and adding some other files
create new local repositories my_theme1, my_theme2 based on my_framework
The goal is to keep everything updated with any underscores update, while changing and modifying the framework and the themes. Once the content from github is pulled it should keep (or inform) of any updates, but I don't need any change I make locally to go back in the path.
I am not sure which path to follow, and would appreciate any help or pointer.
Assuming you using a terminal, cd to the themes directory:
Now clone _s to your project:
After the clone ends you can start working with your new theme. cd to theme directory:
and create another remote for your repo.
From now on, you can push change into your private remote:
and if you want to get updates from _s repo you can just:
Good Luck!
you could do something like
git clone https://github.com/Automattic/_s.git
create directory
my_framework
withmkdir my_framework
(if on windows)cd my_framework
git init
git remote add <_s> <PATH to your local underscore>
git pull
(to get latest version of underscore)again:
mkdir my_theme1
cd my_theme1
git init
git remote add <my_framework> <PATH to your local my_framework>
git pull
Hope this is what you are looking for!
That is called the triangular workflow:
automattic/_s
clone that fork locally,
add as remote upstream the original repo
From there, with git 2.9 or more, configure:
Finally, each time you want to update your branches (where you modify your own version of the original repo), do a
Then you can merge that updated branch (after testing it) to your other repos
my_theme1
,my_theme2
, cloned from myfork.If you want to work locally only, you can skip the fork step and clone directly the original repo.
What you want to do is called nested git repo. GitHub does not allow nested repositories. You can use GitSubmodule or subtree. It is done for when projects become bigger.
One copy of underscores will remain as "control". Second copy of underscores will remain is starting of
my_framework
. Third copy is copied and modification ofmy_framework
.You can :
underscores repo
aka WordPress starter theme underscore master separatelymy_theme1
,my_theme2
are not versions but separate softwares.my_theme1
as example can have nth versions. Here are sample steps :Work after this step to clone, update in the way whatever like others written.
You can "auto update" too. Add files named
post-checkout
& post-merge to.git/hooks
directory of the needed repositories and add this into each of them:you should learn about child themes. the concept of it is having a main theme - which gets updated - and a child theme that'll you'll modify, add content, create different templates & styles... everything to your needs.
I'd recommend taking some minutes to read this throughtfully: https://codex.wordpress.org/Child_Themes