Created
August 25, 2024 13:11
-
-
Save AbiruzzamanMolla/85579fe8c4b556fa9b4fc5bde89c3c2a to your computer and use it in GitHub Desktop.
gitbash alies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the gitupdate function | |
gitupdate() { | |
local commitMessage="$1" | |
local branch="$2" | |
if [ -z "$commitMessage" ]; then | |
echo "Error: Commit message is required." | |
return 1 | |
fi | |
echo -e "\nExecuting gitupdate command with the following actions:" | |
echo " - Staging all changes in the repository." | |
echo " - Committing changes with message '$commitMessage'." | |
if [ -n "$branch" ]; then | |
echo " - Pushing changes to branch '$branch'." | |
else | |
echo " - Pushing changes to the current branch." | |
fi | |
# Display current repository status | |
echo -e "\n\nCurrent Git status:" | |
git status | |
# Stage all changes | |
echo -e "\n\nStaging all changes..." | |
sleep 0.5 | |
echo -n "Adding files to staging area:" | |
spinner='-\|/' | |
for i in {1..10}; do | |
echo -n "${spinner:i%${#spinner}:1}" | |
sleep 0.1 | |
echo -en "\b" | |
done | |
git add . | |
echo -e "\nFiles added to staging area successfully." | |
# Commit with the provided message | |
echo -e "\n\nCommitting changes with message '$commitMessage'..." | |
sleep 0.5 | |
echo -n "Committing changes:" | |
for i in {1..10}; do | |
echo -n "${spinner:i%${#spinner}:1}" | |
sleep 0.1 | |
echo -en "\b" | |
done | |
git commit -m "$commitMessage" | |
echo -e "\nChanges committed successfully." | |
# Push changes | |
if [ -n "$branch" ]; then | |
echo -e "\n\nPushing changes to branch '$branch'..." | |
else | |
echo -e "\n\nPushing changes to current branch..." | |
fi | |
sleep 0.5 | |
echo -n "Pushing changes:" | |
for i in {1..10}; do | |
echo -n "${spinner:i%${#spinner}:1}" | |
sleep 0.1 | |
echo -en "\b" | |
done | |
if [ -n "$branch" ]; then | |
git push origin "$branch" | |
else | |
git push | |
fi | |
echo -e "\nChanges pushed successfully." | |
# Display updated repository status | |
echo -e "\n\nUpdated Git status:" | |
git status | |
} | |
# Alias for the function | |
alias gitupdate=gitupdate | |
alias pa='php artisan' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment