Hexo blog development-theme theme backup upload failed

A phenomenon

When Hexo is upgraded, when the theme theme is uploaded to GitHub, there is only the theme name, and there is no theme corresponding file in the theme folder (the theme file backup failed)

<!--more-->

Two causes

This is because the git submodule function is used (you clone other people's projects in your git project).

In the git repository of your main project, the submodule is just a HEAD pointer to the commit of the submodule.

The meaning of this function:

  • Here, if you need to modify the next theme (which may require a lot of documents), and want to ensure that you can update the latest version at any time, its practical sub-module function is very convenient

  • Just clone and create a new branch for your own use. Every time the official update pulls to another branch, just merge.

  • It is equivalent to dividing a large project into multiple small projects to minimize the association between projects and facilitate debugging and modification.

  • Here I am lazy and delete the submodule directly, backing up the entire warehouse

Three revision process

3.1 File structure in the themes directory

next-v7.1.1
next-v7.8.0

3.2 Remove the next theme that has not been uploaded

git rm --cached themes/next-v7.8.0

 

3.3 git status-view the status after removing the theme

On branch hexo
Your branch is up-to-date with 'origin/hexo'.
​
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
​
        deleted:    themes/next-v7.8.0
​
Untracked files:
  (use "git add <file>..." to include in what will be committed)
​
        themes/next-v7.8.0/

3.4 git add themes/next-v7.8.0/ (resubmit the theme folder next-v7.8.0)

3.5 git status — view the status after submitting the subject

On branch hexo
Your branch is up-to-date with 'origin/hexo'.
​
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
​
        deleted:    themes/next-v7.8.0
        new file:   themes/next-v7.8.0/.editorconfig
        new file:   themes/next-v7.8.0/.eslintrc.json
        new file:   themes/next-v7.8.0/.gitattributes
        new file:   themes/next-v7.8.0/.github/CODE_OF_CONDUCT.md
        new file:   themes/next-v7.8.0/.github/CONTRIBUTING.md
        new file:   themes/next-v7.8.0/.github/ISSUE_TEMPLATE/bug-report.md
        new file:   themes/next-v7.8.0/.github/ISSUE_TEMPLATE/feature-request.md
        new file:   themes/next-v7.8.0/.github/ISSUE_TEMPLATE/other.md
        new file:   themes/next-v7.8.0/.github/ISSUE_TEMPLATE/question.md

3.6 git commit -m "Backup next-v7.8.0 theme" (submit)

3.7 git push origin hexo (push to GitHub and back up to the hexo branch)

 

Four references

Guess you like

Origin blog.csdn.net/Calvin_zhou/article/details/109019569