cd "$pwd"
}
+gitf_commit() {
+ declare file="${1:?Args 1: file is missing}"
+ declare default="${file##$(git_root)/}"
+ declare comment
+ read -e -p "Your comment: " -i "$default" comment
+ if [ -z "$comment" ]
+ then
+ echo "> Commit canceled because of empty comment!"
+ return 1
+ fi
+ git commit -m "$comment" -a
+}
+
gitf_publish() {
case "$@" in
--help|-h)
#
# Commit
#
- declare comment
if [ -n "$(git status --porcelain "$file")" ]
then
printf "$fmt" "COMMIT"
- declare default="${file##$(git_root)/}"
- read -e -p "Your comment: " -i "$default" comment
- if [ -z "$comment" ]
- then
- echo "> Commit canceled because of empty comment!"
- return 1
- fi
- # NB 12.05.23 git commit -m "$comment" "$file"
- git commit -m "$comment" -a
+ gitf_commit "$file"
fi
echo git filter-branch --index-filter "git rm --cached --ignore-unmatch $@" --force --prune-empty -- --all
}
-# NB 03.05.23 gitcd() {
-# NB 03.05.23
- # NB 03.05.23 shell_help_noarg "Change directory to run git commands\nUsage: $FUNCNAME FILE|DIR GIT_ARGUMENTS" "$@" && return 1
- # NB 03.05.23 local i d dir args
- # NB 03.05.23 local pwd; pwd=$PWD
- # NB 03.05.23 #for i in $@; do
-# NB 03.05.23
- # NB 03.05.23 while [ $# -gt 0 ]; do
-# NB 03.05.23
- # NB 03.05.23 i="$1"
-# NB 03.05.23
- # NB 03.05.23 # Replace file with realpath
- # NB 03.05.23 if [ -e "$i" ]; then
- # NB 03.05.23 i=$(realpath "$i")
-# NB 03.05.23
- # NB 03.05.23 # if dir stay there
- # NB 03.05.23 #[ -d "$i" ] && i="$i/.git"
- # NB 03.05.23 [ -d "$i" ] && i="$i/README.md"
-# NB 03.05.23
- # NB 03.05.23 d=$(dirname "$i")
-# NB 03.05.23
- # NB 03.05.23 dir="$d"
- # NB 03.05.23 fi
-# NB 03.05.23
- # NB 03.05.23 shell_push_arg "$i" args
- # NB 03.05.23 shift
-# NB 03.05.23
- # NB 03.05.23 done
-# NB 03.05.23
- # NB 03.05.23 [ -z "$dir" ] && echo "Can't find any file in $@" && return 1
-# NB 03.05.23
- # NB 03.05.23 cd "$dir" || return
- # NB 03.05.23 #echo PWD=$(pwd)
-# NB 03.05.23
- # NB 03.05.23 eval git ${args}
-# NB 03.05.23
- # NB 03.05.23 cd "$pwd"
-# NB 03.05.23
-# NB 03.05.23 } # < gitcd()
-
git_commit_push() {
git commit -a -m "$*" && git push
}