Skip to content

Instantly share code, notes, and snippets.

@kbingham
Created September 27, 2021 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbingham/59c03207a761a061a10831a00d843504 to your computer and use it in GitHub Desktop.
Save kbingham/59c03207a761a061a10831a00d843504 to your computer and use it in GitHub Desktop.
Create 'banner' commits in a branch to separate topics
#!/bin/sh
## Often used with interactive rebases to split patch groups
## git rebase -i
## add lines such as:
## x git banner-commit "Submitted"
## dot-files are created so that the commits are not empty, and persist.
columns=52
line="$*"
pad=$(( (columns - ${#line}) / 2))
# printf "%*s\n" $(( (${#line} + columns) / 2)) "$line"
padding() {
for i in `seq 2 1 $1`; do
echo -n "="
done;
}
banner() {
padding $pad
echo -n " $line "
padding $pad
echo ""
}
output=$(banner)
echo $output
echo "$output" | xclip -selection clipboard
echo "The result has been copied to the clipboard"
file=".$line"
touch "$file"
git add -f "$file"
git commit --no-verify "$file" -m "$output" -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment