Merge pull request #1 from selimaj-dev/simple-git-commands

Simple git commands
This commit is contained in:
Klesti Selimaj
2026-02-08 03:46:52 +01:00
committed by GitHub
2 changed files with 61 additions and 0 deletions
+12
View File
@@ -1,16 +1,28 @@
# shell-productivity # shell-productivity
My zsh/bash productivity aliases / tools / scripts My zsh/bash productivity aliases / tools / scripts
## Installation ## Installation
### Step 1 ### Step 1
```bash ```bash
cd ~ cd ~
git clone https://github.com/selimaj-dev/shell-productivity.git git clone https://github.com/selimaj-dev/shell-productivity.git
``` ```
### Step 2 (zsh) ### Step 2 (zsh)
Add this into your `.zshrc` Add this into your `.zshrc`
```bash ```bash
source ~/shell-productivity/rc.zsh source ~/shell-productivity/rc.zsh
``` ```
## Usage
- `gpr <branch>` - **git checkout -b <branch> && git push origin <branch> git branch -D <branch>**
- `ga` - **git add -A**
- `gp` - **git pull**
- `gc <message>` - **git commit -am <message>**
- `postpr` - **Done after a pull request is merged, switches to master and removes the pr branch and pulls**
+49
View File
@@ -0,0 +1,49 @@
# Silently remove any conflicting aliases
unalias postpr 2>/dev/null
unalias gpr 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"
}
gpr() {
git checkout -b $1
git push origin $1
git checkout master
git branch -D $1
}
gc() {
git commit -am $1
}
ga() {
git add -A
}
gp() {
git pull
}