www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

index.md (1069B)


      1 ---
      2 title: "2024, Day 2: Git pre-push hook for Hugo, part 1"
      3 description: "I need to stop pushing drafts, and this is how I hope to do that"
      4 date: 2024-12-02T20:29:39-08:00
      5 draft: false
      6 ---
      7 
      8 I build this site with Hugo, and I kludged together a tortuous system that
      9 allows me to publish posts using `git push` (I may streamline this during my
     10 December Adventure). I pushed yesterday’s post with the `draft` parameter
     11 set to `true`---not for the first time---which is obnoxious because I need
     12 to make a new commit and push _that_, leaving an untidy commit history.
     13 
     14 For today’s project I started looking into writing a [pre-push
     15 hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) that would
     16 prevent me from pushing draft posts to my webserver. I thought the sample
     17 hooks would provide more guidance than they do, so I’m finding that this is
     18 a bigger job than I expected. I need to learn a couple [Git plumbing
     19 commands](https://git-scm.com/book/en/v2/Appendix-C%3A-Git-Commands-Plumbing-Commands)
     20 to do this right, so I’m not going to finish today.