Simple git commands

This commit is contained in:
2026-02-08 03:40:44 +01:00
parent 9b7d42c530
commit 3bb428e060
2 changed files with 52 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# Silently remove any conflicting aliases
unalias postpr 2>/dev/null
unalias gc 2>/dev/null
unalias ga 2>/dev/null
unalias gp 2>/dev/null
# --- Functions ---
postpr() {
# Save current branch
local current_branch
current_branch=$(git symbolic-ref --short HEAD)
if [[ "$current_branch" == "master" ]]; then
echo "You are already on master!"
return 1
fi
# Switch to master
git checkout master || return 1
# Pull latest changes
git pull origin master || return 1
# Delete previous branch locally
git branch -d "$current_branch" || echo "Failed to delete branch $current_branch. Maybe unmerged changes?"
echo "Switched to master, pulled latest, and deleted branch $current_branch"
}
gc() {
git commit -am $1
}
ga() {
git add -A
}
gp() {
git pull
}