![]() Be sure you don’t have a trailing slash in the module path when executing this command. This command will remove the themes/hermit path from the git tracking. I removed these lines from the config file. This is all your local configuration of your repo. There is one other location where this data is stored i.e.git/config file. gitmodules is a file which stores information about modules and should be commited to the repo. I’ll go ahead and delete the first 3 lines. ![]() We need to first delete the submodule and then add it back. git doesn’t comes with a magic command to replace theme in my situation. Now I want to change my theme to something else. Just that I have many blog post made and each commit represent a post made. My website at present is in similar state as shown in the log above. If you add commits to a submodule, the parent project won’t know. Submodule resides in the repo and only get updated when you want to. Mostly you’ll be working with the main repo doing commits. At this stage the main repository can be pushed to remote, say at /santosh/myblog. ![]() We have two repository now, the main repository which is maintained by you and hermit theme repository. ![]() Submodules are tracked by the exact commit specified in the parent project, not a branch, a ref, or any other symbolic reference. * 0f1d8e5 - Initial commit ( 45 minutes ago ) * 651c044 - Add hermit theme ( 7 minutes ago ) * b5a80a7 - Update config.toml for hermit ( 5 minutes ago ) * 61087cf - (HEAD -> master ) Add a few posts ( 63 seconds ago ) As you can see below, our site has no theme at this point in time. $ git commit -m "Initial commit" Initial commitĪbove I have created a bare Hugo site, entered and initialized that directory as a git repo and did the initial commit. Initialized empty Git repository in /home/sntshk/repos/myblog/.git/ Visit for quickstart guide and full documentation. Start the built-in live server via "hugo server". Download a theme into the same-named folder.Ĭreate your own with the "hugo new theme " command.Ģ. Just a few more steps and you 're ready to go:ġ. Install HugoĮasiest method for me to install hugo is to use go get command.Ĭongratulations! Your new Hugo site is created in /home/sntshk/repos/myblog. Consult your OS’s package manager or if you using Windows, consult getting started guide at Hugo’s site. If you are following this tutorial with me, you need to install Hugo on your system. I keep theme as a separate module because want to reduce overhead when updating to the new theme version, which will be deleting and adding a whole new version of theme repo. Setting Up the Repo Structureįor this example I will we demonstrating this concept with my blogging engine Hugo and the submodule which is a theme for Hugo. While you read this post, take a moment to connect with me on LinkedIn. Suppose you are working with softwareA which depends on libraryA, instead of copy-pasting the libraryA over and over again when a new version of the library is released what we can do is use submodule to make this process DRY and elegant. Instead of being tightly coupled, it is loosely coupled and is easy to maintain. One git repository can be added to another as a submodule and maintained separately. Git Submodules are the concept related to modularity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |