Displaying current git branch in MacOS zsh prompt

Previous script for setting git branch in bash shell is here.

For zsh, here’s an approach from this gist – add to your ~/.zshrc:

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

COLOR_DEF=$'\e[0m'
COLOR_USR=$'\e[38;5;243m'
COLOR_DIR=$'\e[38;5;197m'
COLOR_GIT=$'\e[38;5;39m'
setopt PROMPT_SUBST
export PROMPT='${COLOR_USR}%n ${COLOR_DIR}%~ ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF} $ '

git tags and pushing to a remote repo

Tags are useful to mark specific versions or releases of your code in a repo on a given branch. To tag everything on the current branch, use:

git tag new-tag-name

To push a new tag to a remote repo, you can either push all tags (which is not recommended):

git push remote-name --tags

or push a specific tag:

git push remote-name tag-name

More example in this SO question.

Assigning GitLab runners to a project

Following on from this post, Runners are added per project (unless they are shared). If you’re configuring a new project and haven’t created a new runner and assigned it to your  project, you’ll see this:

Add a new runner per the steps in the previous article.