Added commit option to git.fish
This commit is contained in:
parent
bd5359dcfc
commit
1a48d5e8fb
1 changed files with 19 additions and 0 deletions
|
@ -13,9 +13,28 @@ set branch "main"
|
|||
cd (git rev-parse --show-toplevel)
|
||||
switch $action
|
||||
case push
|
||||
set changes (git status --porcelain "$subtree_path")
|
||||
if test -n "$changes"
|
||||
set_color yellow; echo " Cannot push. There are uncommitted changes in $subtree_path."
|
||||
exit 1
|
||||
end
|
||||
git subtree push --prefix="$subtree_path" $remote $branch
|
||||
case pull
|
||||
git subtree pull --prefix="$subtree_path" $remote $branch
|
||||
case commit
|
||||
set changes (git status --porcelain "$subtree_path")
|
||||
if test -z "$changes"
|
||||
echo "No changes to commit in $subtree_path."
|
||||
exit 0
|
||||
end
|
||||
echo " Enter commit message:"
|
||||
read commit_message
|
||||
if test -z "$commit_message"
|
||||
echo "Commit message cannot be empty."
|
||||
exit 1
|
||||
end
|
||||
git add "$subtree_path"
|
||||
git commit -m "$commit_message"
|
||||
case '*'
|
||||
echo "Unknown argument. Use push or pull."
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue