Skip to content

Instantly share code, notes, and snippets.

@hhhaiai
Last active February 18, 2022 14:18
Show Gist options
  • Save hhhaiai/45ec2aaf2dc191cb4588b21004c6c2b4 to your computer and use it in GitHub Desktop.
Save hhhaiai/45ec2aaf2dc191cb4588b21004c6c2b4 to your computer and use it in GitHub Desktop.
git commit
gpp() {
if [ -z "$(git status --porcelain)" ]
then
echo "============================nothing to update.==============================="
else
git add .
if [ -z "$1" ] ;then
git commit -am "update sth. at $(date '+%Y-%m-%d %H:%M:%S')"
else
git commit -am "$1. at $(date '+%Y-%m-%d %H:%M:%S')"
fi
git push
fi
}
@hhhaiai
Copy link
Author

hhhaiai commented Feb 18, 2022

window bat

@echo off

set one=%1
for /f "delims=" %%t in ('date /T') do set dat=%%t
for /f "delims=" %%t in ('git status --porcelain') do set val=%%t

@REM 判断字符串是否为空
if "%val%" == "" (
    echo "============================nothing to update.==============================="
) else (
    git add .
    if "%one%"=="" (
        echo "null"
        git commit -am "update sth. at %dat%. %os%"
    ) else (

        git commit -am "%one%. at %dat% %os%"
    )
    git push
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment