also to note: my git installation was in the AppData folder, so my path looked like this:
"%LocalAppData%\Programs\Git\etc\profile.d\aliases.sh" OR "C:\Users\<username>\AppData\Local\Programs\Git\etc\profile.d\aliases.sh" OR "~/AppData/Local/Programs/Git/etc/profile.d/aliases.sh" OR "/c/Users/<username>/AppData/Local/Programs/Git/etc/profile.d/aliases.sh"
Tired of typing git add . && git commit -m "msg" && git push every time? I made a gitupdate() Bash function that does it all — with colours & a spinner.
-Stage -Commit -Push
One line in Git Bash. gitupdate "commit message" [branch]
gitupdate(){commitMessage="$1"branch="$2"if[-z"$commitMessage"];then echo-e"\033[31mError:\033[0m Commit message is required."echo"Usage: gitupdate \"commit message\" [branch]"return 1 fi echo-e"\n\033[33mExecuting gitupdate command with the following actions:\033[0m"echo" - Staging all changes in the repository."echo" - Committing changes with message '$commitMessage'."if[-n"$branch"];then echo-e" - Pushing changes to branch '\033[33m$branch\033[0m'."else echo-e" - Pushing changes to the current branch."fi echo-e"\n\033[36mCurrent Git status:\033[0m" git status echo-e"\n\033[32mStaging all changes...\033[0m" spin & SPIN_PID=$!trap"kill -9 $SPIN_PID"$(seq 0 15) git add .kill-9$SPIN_PID 2>/dev/null echo-e"\nFiles added to staging area successfully."echo-e"\n\033[35mCommitting changes with message '$commitMessage'...\033[0m" spin & SPIN_PID=$!trap"kill -9 $SPIN_PID"$(seq 0 15) git commit -m"$commitMessage"kill-9$SPIN_PID 2>/dev/null echo-e"\nChanges committed successfully."if[-n"$branch"];then echo-e"\n\033[33mPushing changes to branch '$branch'...\033[0m" spin & SPIN_PID=$!trap"kill -9 $SPIN_PID"$(seq 0 15) git push origin "$branch"kill-9$SPIN_PID 2>/dev/null else echo-e"\n\033[32mPushing changes to current branch...\033[0m" spin & SPIN_PID=$!trap"kill -9 $SPIN_PID"$(seq 0 15) git push kill-9$SPIN_PID 2>/dev/null fi echo-e"\n\033[36mChanges pushed successfully.\033[0m"echo-e"\n\033[36mUpdated Git status:\033[0m" git status }# Spinner animation for bash spin(){local spinner='-\|/'while :;do for i in$(seq 0 3);do printf"\b${spinner:$i:1}"sleep 0.1 done done}# Alias for conveniencealias gitupdate="gitupdate"
thanks for this.
a little thing to note is this works while navigating in bash
cd /c/'Program Files'/Git/etc/profile.d
not
cd /c/Program Files/Git/etc/profile.d as this one won't work in bash
also to note: my
git
installation was in theAppData
folder, so my path looked like this:Note: place the equal sign ('=') immediately after the alias without any spaces.
Examples:
alias k = 'kubectl' // not working
alias k= 'kubectl' // working
Dude, you're a lifesaver.
Tired of typing git add . && git commit -m "msg" && git push every time?
I made a gitupdate() Bash function that does it all — with colours & a spinner.
-Stage
-Commit
-Push
One line in Git Bash.
gitupdate "commit message" [branch]
I always use
ll
withthanks a lot.
also worked multi-line alias like this:
Tks, dude! It really helped me 😁
Thank you. That is a great help :)
Exactly what I was looking for, thanks!!
thanks for this, my workflow thanks you ❤️
Great little bit of advice! Totally worked for me. Thank you. :D
Aliases can be created using git config command as well, without actually opening the git files.
so helpful, thanks