I am trying to get a handle on git and am having some difficulty
understanding how to manage my projects. My project was built outside of
version control where my extensions used were all git-cloned into my
project. Two of the extensions (page_attachments and copy_move) are
using
previous revisions set up as local branches. The project directory was
then
initialized as a local git repo and the remote.upload.url variable was
set
up. I can ‘git push upload master’ to my online git server at Rails
Playground. It all seems to work properly, but if I try and git-clone my
project to test if it’s working, none of the extensions have any files
in
the vendor/extensions/extensionX directories.
In the past when I was using subversion to manage my projects a
git-cloned
extension maintained its content. How should I be adding extensions to
my
project so that travel with the project?
~Nate
The typical method is with git submodule
. So if I were to install
page_attachments manually, it would be like so:
$ git submodule add
git://github.com/radiant/radiant-page-attachments-extension.git
vendor/extensions/page_attachments
$ git submodule init && git submodule update
You’ll likely need to remove the original extension installation before
you use submodules. Once it’s installed correctly as a submodule, you
can use pull/reset within the extension directory to put it on the
revision that you prefer to use, then commit to the main project to lock
in that revision.
Sean
On Wed, Dec 31, 2008 at 7:25 AM, Sean C. [email protected]
wrote:
One thing I forgot to mention. Whenever you clone the project again, you
need to run:
$ git submodule init && git submodule update
This will make sure you download the submodules.
Thanks for your help Sean. Now I have another related question. I am
using
the subscriber_lists extension but on my copy I changed a couple of
things.
Since I cannot use submodule to include the extension, how can I tell
git
ignore the fact that it was a cloned copy of the one on github? Or,
barring
that, how can I download a copy of the code from github (think svn
export)
to make the changes and track the code in my own repo?
Thanks,
Nate
One thing I forgot to mention. Whenever you clone the project again,
you need to run:
$ git submodule init && git submodule update
This will make sure you download the submodules.
Sean
I would suggest forking on github, pushing up your changes to your fork,
and then creating the submodule from the fork. If you don’t want to
track other branches/forks but just keep your changes in the Radiant
project, just clone the extension (not as a submodule) and then remove
its .git directory.
Sean
On Wed, Dec 31, 2008 at 11:45 AM, Sean C. [email protected]
wrote:
I would suggest forking on github, pushing up your changes to your fork,
and then creating the submodule from the fork. If you don’t want to track
other branches/forks but just keep your changes in the Radiant project, just
clone the extension (not as a submodule) and then remove its .git directory.
Thanks. I am really not feeling the git love right now so I am going to
try
and avoid adding more complexity to my situation by starting a fork. I
did
remove the .got directory from my locally cloned copy of the
subscriber_lists extension, but when I run git submodule I keep getting
this
error:
No submodule mapping found in .gitmodules for path
‘vendor/extensions/subscriber_lists’
Preceding the error, I git a list of the extensions that I have set up
as
submodules and there is one (tags) that should show up as a submodule as
well, but nothing gets past this error.
To remove the .git directory did an ‘rm -rf’ to remove it and a ‘git rm’
just to make sure it was out of git.
Any ideas?
~Nate
On Wed, Dec 31, 2008 at 11:59 AM, Nate T. [email protected]
wrote:
and avoid adding more complexity to my situation by starting a fork. I did
remove the .got directory from my locally cloned copy of the
subscriber_lists extension, but when I run git submodule I keep getting this
error:
No submodule mapping found in .gitmodules for path
‘vendor/extensions/subscriber_lists’
Nevermind. I hadn’t done a ‘git add .’ and commit to add the files to
the
repo. It’s working now.
Thanks,
Nate