Last active
September 9, 2025 14:37
-
-
Save spektraldevelopment/3ec5534a9225f4aaf1d38f8f80340030 to your computer and use it in GitHub Desktop.
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
[alias] | |
# Alias: Status | |
# Desc: Displays the git status | |
# Usage: git st | |
st = !git status | |
# Alias: Checkout Branch | |
# Desc: Checks out a branch and pulls it | |
# Usage: git co branch-name ex. git co feature/branch-name | |
co = !git checkout $1 && git pull && : | |
# Alias: Push Origin | |
# Desc: Pushes the current branch to origin | |
# Usage: git po feature/branch-name | |
po = push origin | |
# Alias: Fetch and Pull | |
# Desc: Fetches all remotes, prunes, and pulls the current branch | |
# Usage: git fp | |
fp = !git fetch --all -p && git pull && : | |
# Alias: Create Branch | |
# Desc: Creates a new branch, checks it out, and pushes it to origin | |
# Usage: git cb branch-name ex. git cb feature/branch-name | |
cb = !git branch $1 && git checkout $1 && git push origin $1 && : | |
# Alias: Clean Branch | |
# Desc: Cleans the current branch of untracked files and displays the status | |
# Usage: git clean-branch | |
clean-branch = !git clean -f -d && git status && : | |
# Alias: Reset Branch | |
# Desc: Resets the current branch to HEAD and displays the status | |
# Usage: git reset-branch | |
reset-branch = !git reset --hard HEAD && git status && : | |
# Alias: Current Branch | |
# Desc: Returns the current branch name | |
# Usage: git current | |
current = !git rev-parse --abbrev-ref HEAD | |
# Alias: Commit to current branch | |
# Desc: Commits to the current branch with the current branch name in the commit message | |
# Usage: git cm "commit message" ex. git cm "Hello world" will create a the commit message "[branch-name] - Hello world" | |
cm = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Commit to current branch; \ | |
echo "====="; \ | |
echo Commit message: "[$(git current)] - ${1}"; \ | |
echo " "; \ | |
git commit --no-verify -m \"[$(git current)] - ${1}\"; \ | |
echo " "; \ | |
echo Completed: Commit to current branch; \ | |
}; f" | |
# Alias: Add all, Commit, and Push to origin branch | |
# Desc: Adds all files, commits, and pushes to the origin branch with the current branch name in the commit message | |
# Usage: git acmp "commit message" ex. git acmp "Hello world" will create a the commit message "[branch-name] - Hello world" | |
acmp = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Add all, Commit, and Push to current branch; \ | |
echo "====="; \ | |
echo Commit message: "[$(git current)] - ${1}"; \ | |
echo " "; \ | |
echo Adding all files; \ | |
git add -A; \ | |
echo Committing; \ | |
git commit --no-verify -m \"[$(git current)] - ${1}\"; \ | |
echo Pushing to origin/$(git current); \ | |
git push origin $(git current); \ | |
echo " "; \ | |
echo Completed: Add all, Commit, and Push to current branch; \ | |
}; f" | |
# Alias: Commit and Push to origin branch | |
# Desc: Commits and pushes to the origin branch, the current branch name | |
# is added to the commit message in square brackets | |
# Usage: git cmp "commit message" ex. git cmp "Hello world" will create a the commit message "[branch-name] - Hello world" | |
cmp = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Commit and Push to current branch; \ | |
echo "====="; \ | |
echo Commit message: "[$(git current)] - ${1}"; \ | |
echo " "; \ | |
echo Committing; \ | |
git commit --no-verify -m \"[$(git current)] - ${1}\"; \ | |
echo Pushing to origin/$(git current); \ | |
git push origin $(git current); \ | |
echo " "; \ | |
echo Completed: Commit and Push to current branch; \ | |
}; f" | |
# Alias: Reset and Clean Current Branch | |
# Desc: Resets and cleans the current branch of untracked files | |
# Usage: git rc branch-name ex. git rc feature/branch-name | |
rc = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Reset and Clean current branch; \ | |
echo "====="; \ | |
echo Resetting Branch; \ | |
git reset --hard HEAD; \ | |
echo Cleaning branch; \ | |
git clean -f -d; \ | |
echo Completed: Reset and Clean current branch; \ | |
git status; \ | |
}; f" | |
# Alias: Delete Remote and Local Branch | |
# Desc: Deletes a remote and local branch by name simultaneously | |
# Usage: git drl branch-name | |
drl = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Delete remote and local branch; \ | |
echo "====="; \ | |
echo Deleting remote branch: ${1}; \ | |
git push origin --delete ${1}; \ | |
echo Deleting local branch: ${1}; \ | |
git branch -D ${1}; \ | |
echo Completed: Delete remote and local branch; \ | |
}; f" | |
# Alias: Log Commits and Messages | |
# Desc: Logs commits in current branch that match a commit message partial | |
# Usage: git lcm "commit message partial" | |
lcm = "!f() { \ | |
echo "====="; \ | |
echo Git Alias: Logs commits in current branch that match a commit message partial; \ | |
echo Returns the commit has and the commit message, merges are skipped; \ | |
echo "====="; \ | |
echo @@@Start of Log@@@; \ | |
git log --all --grep="${1}" --pretty=format:\"%C(magenta)%h%Creset -%C(red)%d%Creset %s\" --no-merges; \ | |
echo @@@End of Log@@@; \ | |
echo Completed: git log by commit; \ | |
}; f" | |
[user] | |
name = Your Name | |
email = [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment