feat(git): handle "other args"
This commit is contained in:
parent
2a74d2e273
commit
cd67f7c51d
1 changed files with 12 additions and 15 deletions
27
git.sh
27
git.sh
|
@ -9,9 +9,14 @@ command=$1
|
||||||
journal_dir="${notes_dir}/Journal"
|
journal_dir="${notes_dir}/Journal"
|
||||||
month_dir=$(date +"%m %b")
|
month_dir=$(date +"%m %b")
|
||||||
|
|
||||||
|
git reset HEAD -- .
|
||||||
|
other_args="${@:2}"
|
||||||
|
echo $@
|
||||||
|
echo "args $other_args"
|
||||||
|
|
||||||
gitStatus() {
|
gitStatus() {
|
||||||
{
|
{
|
||||||
git add .
|
git add $other_args
|
||||||
git status
|
git status
|
||||||
} || {
|
} || {
|
||||||
# Report; TODO: write log
|
# Report; TODO: write log
|
||||||
|
@ -21,9 +26,9 @@ gitStatus() {
|
||||||
|
|
||||||
gitCommit() {
|
gitCommit() {
|
||||||
{
|
{
|
||||||
git add .
|
git add $other_args
|
||||||
read -p "Message: " message
|
read -p "Message: " message
|
||||||
git commit -m "$message" $*
|
git commit -m "$message" $other_args
|
||||||
}|| {
|
}|| {
|
||||||
# Report; TODO: write log
|
# Report; TODO: write log
|
||||||
echo ">>> Commit failed"
|
echo ">>> Commit failed"
|
||||||
|
@ -40,23 +45,15 @@ gitPush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "diff" ] || [ "$1" = "d" ]; then
|
if [ "$1" = "diff" ] || [ "$1" = "d" ]; then
|
||||||
git add .
|
git add $other_args
|
||||||
git diff --staged
|
git diff --staged
|
||||||
elif [ "$1" = "stat" ]; then
|
elif [ "$1" = "stat" ]; then
|
||||||
gitStatus
|
gitStatus
|
||||||
elif [ "$1" = "push" ]; then
|
elif [ "$1" = "push" ]; then
|
||||||
gitPush
|
gitPush
|
||||||
else
|
else
|
||||||
if [ "$1" = "g" ] || [ "$1" = "git" ]; then
|
git add $other_args
|
||||||
git reset HEAD -- .
|
git status
|
||||||
git add .
|
gitCommit $other_args
|
||||||
git status
|
|
||||||
gitCommit
|
|
||||||
else
|
|
||||||
git reset HEAD -- .
|
|
||||||
git add $*
|
|
||||||
git status
|
|
||||||
gitCommit $*
|
|
||||||
fi
|
|
||||||
gitPush
|
gitPush
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue