Question

I am working on making a blog using pelican. I want to include the existing pelican-plugins in my project without copying the code into my repository. For example:

/my_project
    pelicanconf.py
    /plugins        # Just a reference to https://github.com/getpelican/pelican-plugins
        assets
        ...

I know that this is possible via git submodule as follows:

git submodule add https://github.com/getpelican/pelican-plugins.git plugins

However, should I decide to create my own plugins, or user plugins from elsewhere, I can't store them in plugins because that's now a submodule.

How can I commit changes to a folder that is a submodule without committing them to that submodule? Should I just be making a fork of pelican-plugins and commit to that?

Was it helpful?

Solution

The best solution that worked for me in this case was to do as follows:

  1. Fork, or otherwise create a repository for the changes / additions
  2. Use git submodule to add the new repository to my project as a subfolder
  3. Make changes within the submodule, or make changes to the created repository then update the submodule.

If you are as not as particular as I am about how you want the changes tracked, ton's solution using Subtree works fine; the biggest difference is that all of the commits from the repository will be included in the repository's history.

OTHER TIPS

maybe, you should use subtree instead of submodule.

read following articles.

Git - Subtree Merging

Alternatives To Git Submodule: Git Subtree | Atlassian Blogs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top