Git and Hugo

Some useful commands for git and Hugo.

Hugo

Helper script

./orhugo to see options.

Modules

  • hugo mod init to allow module importing / to turn a (sub)directory into a module. Creates a go.mod file.
  • hugo config mounts to refresh and output the current module mounts.
  • hugo mod get -u to update all modules.
  • hugo mod clean --all to clear the current Hugo module cache. All modules will need to be redownloaded, if they haven’t been vendorised.
  • hugo mod vendor to vendorise modules (will be stored in _vendor/). If a dependency exists in _vendor/ then it will be used over cached files.

Git

Helper script

./orgit to see options.

New branches

git checkout -b <branch> to create and switch to new branch.

git push -u origin <branch> to first push the branch to the Github repo.

Deleting branches

git push -d origin <branchname> to delete repo branch.

git branch -d <branchname> to delete locally.

Merging branches into main

See this git guide, and the -m option for ./orgit.

Syncing a fork

See this github guide.

1git fetch upstream
2git checkout <branch name, e.g. master>
3git merge upstream/<branch name> # provide merge message if needed
4git push