문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

maybe, you should use subtree instead of submodule.

read following articles.

Git - Subtree Merging

Alternatives To Git Submodule: Git Subtree | Atlassian Blogs

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top