wip
This commit is contained in:
parent
382312eb23
commit
159f466773
1 changed files with 34 additions and 48 deletions
|
@ -495,25 +495,22 @@ __git__() {
|
||||||
local commit_files=()
|
local commit_files=()
|
||||||
local commit_message
|
local commit_message
|
||||||
|
|
||||||
case "$1" in
|
# case "$1" in
|
||||||
'.')
|
# '.')
|
||||||
commit_files=.
|
# commit_files=.
|
||||||
commit_message="wip"
|
# commit_message="wip"
|
||||||
|
#
|
||||||
echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
# echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
||||||
# echo "${GREEN}Committed files: ${BOLD}${commit_files[*]}${NC}"
|
#
|
||||||
|
# git add "$commit_files"
|
||||||
git add "$commit_files"
|
# git commit -m "$commit_message"
|
||||||
git commit -m "$commit_message"
|
# git push
|
||||||
git push
|
# ;;
|
||||||
;;
|
# *)
|
||||||
*)
|
|
||||||
|
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
if [ -e "$f" ]; then
|
if [ -f "./$f" ] || [ -d "./${f}" ]; then
|
||||||
commit_files+=("$f")
|
commit_files+=("${f}")
|
||||||
# shift
|
|
||||||
else
|
else
|
||||||
commit_message+="${f}"
|
commit_message+="${f}"
|
||||||
break
|
break
|
||||||
|
@ -522,34 +519,23 @@ __git__() {
|
||||||
else
|
else
|
||||||
echo "${BOLD}${YELLOW}You have to provide the command like..:"
|
echo "${BOLD}${YELLOW}You have to provide the command like..:"
|
||||||
echo "${GREEN}'gwip <list of files> <commit message>' or like 'gwip .'${NC}"
|
echo "${GREEN}'gwip <list of files> <commit message>' or like 'gwip .'${NC}"
|
||||||
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z "$commit_files" ]] && commit_files=.
|
case $commit_files in
|
||||||
|
'.') ;;
|
||||||
echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
*)
|
||||||
echo "${GREEN}Committed files: ${BOLD}${commit_files[*]}${NC}"
|
echo "${GREEN}Committed files: ${BOLD}${commit_files[*]}${NC}"
|
||||||
# for f in "${commit_files[@]}"; do
|
|
||||||
# echo git add "$f"
|
|
||||||
# done
|
|
||||||
git add "${commit_files[*]}"
|
|
||||||
git commit -m "${commit_message:-wip}"
|
|
||||||
git push
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# if [ -n "$2" ]; then
|
[[ -z "$commit_files" ]] && commit_files=.
|
||||||
# commit_files="$1"
|
echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
||||||
# commit_message="$2"
|
|
||||||
# else
|
git add "${commit_files[*]}"
|
||||||
# if [ -e "$1" ]; then
|
git commit -m "${commit_message:-wip}"
|
||||||
# commit_files="$1"
|
git push
|
||||||
# commit_message="wip"
|
|
||||||
# else
|
|
||||||
# commit_files="."
|
|
||||||
# commit_message="${1:-wip}"
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
else
|
else
|
||||||
echo "${RED}${BOLD}There are changes on the remote branch. Please pull the latest changes first.${NC}"
|
echo "${RED}${BOLD}There are changes on the remote branch. Please pull the latest changes first.${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue