gitconfigscript

Github Branch Automatic Name

1 min read
0 views






I recommend swapping out `repo` to basically anything else.

Bash
#!/bin/bash# Get the current month and daymonth=$(date +%m)day=$(date +%d)# Prefix the branch name with repo/{month}-{day}branch_name="repo/$month-$day-$1"# change repo to whether you want# Checkout the branchgit checkout -b "$branch_name"

To use on macOS/linux, you can paste the above into a file in `/usr/local/bin` and make it executable with `chmod +x /usr/local/bin/gbn`.

I also recommend setting your git settings to sort branches by `committerdate` so that you can easily find the branch you worked on most recently:

git config --global branch.sort commiterdate

This does work with the default alphabetical sorting, but this works better if you work on features over long periods of time.

0
Back to notes