3 Replies
dysbulic πŸ™
dysbulic πŸ™β€’16mo ago
For anyone interested in Bash, this is the .bashrc I've been adding to for the last 15 years: https://github.com/dysbulic/tip/blob/master/config/bash There's lots of different commands in there. Probably the one I use the most is:
function t() {
if [ -z "$*" ]; then
git commit -S -a
else
echo "Commit: $*"
git commit -S -am "$*"
fi
}
function t() {
if [ -z "$*" ]; then
git commit -S -a
else
echo "Commit: $*"
git commit -S -am "$*"
fi
}
This lets me type t this is my commit message & it'll do a git commit. That & before I run that, I'll run
function d() {
(
git -c color.ui=always status -v
git -c color.ui=always diff --staged
git -c color.ui=always diff
while IFS= read -r -d $'\0' file; do
isutf8 "$file" 2>&1 > /dev/null
IS_TEXT=$?
if [ -f "$file" ]; then
echo -e "\x1B[0;31mUntracked:\x1B[0m \x1B[1;33m$file\x1B[0m"
if [ $IS_TEXT -eq 0 ]; then
awk '{ print " " $0 }' "$file"
else
echo -e " \x1B[1;35mNot Printing Binary…\x1B[0m"
fi
fi
done < <(git ls-files --others --exclude-standard -z)
) | bat
}
function d() {
(
git -c color.ui=always status -v
git -c color.ui=always diff --staged
git -c color.ui=always diff
while IFS= read -r -d $'\0' file; do
isutf8 "$file" 2>&1 > /dev/null
IS_TEXT=$?
if [ -f "$file" ]; then
echo -e "\x1B[0;31mUntracked:\x1B[0m \x1B[1;33m$file\x1B[0m"
if [ $IS_TEXT -eq 0 ]; then
awk '{ print " " $0 }' "$file"
else
echo -e " \x1B[1;35mNot Printing Binary…\x1B[0m"
fi
fi
done < <(git ls-files --others --exclude-standard -z)
) | bat
}
Which shows me all the changes that're going to be committed with git commit -a.
πŸ‘Ύ  |  Lofty  |  πŸ‘Ύ
would you mind if I share this at other places?
dysbulic πŸ™
dysbulic πŸ™β€’16mo ago
Not at all.