Last active
September 28, 2025 11:34
-
-
Save AbiruzzamanMolla/f342124e977eb92f9d20ec6b73ddd831 to your computer and use it in GitHub Desktop.
Paste this in your windows "C:\Program Files\Git\etc\profile.d"
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
| # --show-control-chars: help showing Korean or accented characters | |
| alias ls='ls -F --color=auto --show-control-chars' | |
| alias ll='ls -lash' | |
| alias gc="git commit -m" | |
| alias ga="git add ." | |
| alias gs="git status" | |
| alias gp="git push" | |
| alias gpl="git pull" | |
| alias art="php artisan" | |
| alias hphp="herd php" | |
| alias hcomposer="herd composer" | |
| alias pserve="php -S 127.0.0.1:8080 -t ./" | |
| 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 convenience | |
| alias gpush="gitupdate" | |
| # Function: mywork | |
| myworkFn() { | |
| # Get current date and time | |
| dateTime=$(date +"%Y-%m-%d %H:%M:%S") | |
| echo "Date: $dateTime" | |
| echo "" | |
| # Initialize index | |
| index=1 | |
| # Prepare output | |
| output="Date: $dateTime\n\nCommit Messages:\n" | |
| # Collect today's commits | |
| while IFS= read -r line; do | |
| echo "$index. $line" | |
| output+="$index. $line\n" | |
| index=$((index+1)) | |
| done < <(git log --since=midnight --pretty=format:"%s") | |
| # File path | |
| filePath="$(pwd)/myworks.md" | |
| # Read existing content if file exists | |
| if [ -f "$filePath" ]; then | |
| existingContent=$(cat "$filePath") | |
| else | |
| existingContent="" | |
| fi | |
| # Combine new + old | |
| newContent="$output\n\n$existingContent" | |
| # Write back | |
| echo -e "$newContent" > "$filePath" | |
| } | |
| # Alias | |
| alias mywork=myworkFn | |
| # Function: myworkSince | |
| myworkSinceFn() { | |
| if [ -z "$1" ]; then | |
| echo "⛔ Please provide a date. Example: myworksince '2024-12-01'" | |
| return 1 | |
| fi | |
| # Validate date (basic check) | |
| if ! date -d "$1" >/dev/null 2>&1; then | |
| echo "⛔ Invalid date format. Use something like '2024-12-01'" | |
| return 1 | |
| fi | |
| formattedDate=$(date -d "$1" +"%Y-%m-%d %H:%M:%S") | |
| dateTime=$(date +"%Y-%m-%d %H:%M:%S") | |
| echo "Date: $dateTime (Commits since $formattedDate)" | |
| echo "" | |
| index=1 | |
| output="Date: $dateTime (Commits since $formattedDate)\n\nCommit Messages:\n" | |
| while IFS= read -r line; do | |
| echo "$index. $line" | |
| output+="$index. $line\n" | |
| index=$((index+1)) | |
| done < <(git log --since="$formattedDate" --pretty=format:"%s") | |
| filePath="$(pwd)/myworks.md" | |
| if [ -f "$filePath" ]; then | |
| existingContent=$(cat "$filePath") | |
| else | |
| existingContent="" | |
| fi | |
| newContent="$output\n\n$existingContent" | |
| echo -e "$newContent" > "$filePath" | |
| } | |
| # Alias | |
| alias myworksince=myworkSinceFn | |
| case "$TERM" in | |
| xterm*) | |
| # The following programs are known to require a Win32 Console | |
| # for interactive usage, therefore let's launch them through winpty | |
| # when run inside `mintty`. | |
| for name in node ipython php php5 psql python2.7 winget | |
| do | |
| case "$(type -p "$name".exe 2>/dev/null)" in | |
| ''|/usr/bin/*) continue;; | |
| esac | |
| alias $name="winpty $name.exe" | |
| done | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment