Git config per directory

I discovered gitconfig’s includeIf feature can change your global Git config depending on which directory you are working in. This is super useful if you have different identities for different project, or you need to specify the SSH key to use, etc.. in my case I want to use my personal email address for personal projects and work email for work projects. So let’s assume a directory layout like this:...

February 9, 2023 · 1 min · 183 words

Git Commands

Some of my most visited Stack Overflow answers are on how to use Git! We all remember how to add, commit, push, but how often to do you rebase, resolve merge conflicts, modify old commits? Here I’m going to list out all the Git commands I usually look-up! Including any relevant updates, since Git and the way we use Git is always evolving! Commands Git config for a directory full of repositories When you have sets of git repositories with different credentials it can be useful to manage shared git configuration across them....

February 2, 2023 · 5 min · 860 words

Automatically set your github.io domain in GitHub Actions

Collaborative websites need to be forked, but if you set a hostname variable, such as baseURL in Hugo, the forked website will load resources from the original.. Not ideal. The fix I applied to my GitHub Actions CI to work around this: ...

April 20, 2021 · 1 min · 97 words

Host Hugo static website on GitHub Pages using Actions and my domain

In a cost-saving exercise I wanted to try host my personal website on a free platform, since the code repository is hosted on GitHub, I decided to look into GitHub pages. ...

March 12, 2021 · 5 min · 871 words

Git feature branch & merge

Start with your master branch git checkout master git fetch origin If your local master has been modified, you can reset its state. git reset --hard origin/master Checkout a new feature branch. git checkout -b my-feature Make changes in this branch, committing as usual. git add file.txt git commit -m "add my file.txt" You can push your branch to allow others and yourself to evaluate and commit further to it....

April 9, 2019 · 1 min · 210 words