Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / gitcheats.txt
Last active February 4, 2025 02:44
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# make a private git repo public that is private with gh cli
gh repo edit --accept-visibility-change-consequences --visibility public
# sort list of git repos with gh cli
gh repo list --limit 300 --json name -q '.[].name' | sort