From 3bb428e060e87f271c79dbea939e0012a1c5684a Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 8 Feb 2026 03:40:44 +0100 Subject: [PATCH 1/3] Simple git commands --- README.md | 11 +++++++++++ rc.zsh | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 rc.zsh diff --git a/README.md b/README.md index 7159b52..2b1e5fa 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,27 @@ # shell-productivity + My zsh/bash productivity aliases / tools / scripts ## Installation ### Step 1 + ```bash cd ~ git clone https://github.com/selimaj-dev/shell-productivity.git ``` ### Step 2 (zsh) + Add this into your `.zshrc` + ```bash source ~/shell-productivity/rc.zsh ``` + +## Usage + +`ga` - **git add -A** +`gp` - **git pull** +`gc ` - **git commit -am ** +`postpr` - **Done after a pull request is merged, switches to master and removes the pr branch and pulls** diff --git a/rc.zsh b/rc.zsh new file mode 100644 index 0000000..e8a526c --- /dev/null +++ b/rc.zsh @@ -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 +} From 1716076a3f8417497816d59ebcc90c5f511e9f1b Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 8 Feb 2026 03:44:13 +0100 Subject: [PATCH 2/3] gpr --- README.md | 9 +++++---- rc.zsh | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2b1e5fa..0455bdc 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ source ~/shell-productivity/rc.zsh ## Usage -`ga` - **git add -A** -`gp` - **git pull** -`gc ` - **git commit -am ** -`postpr` - **Done after a pull request is merged, switches to master and removes the pr branch and pulls** +- `gpr ` - **git checkout -b && git push origin git branch -D ** +- `ga` - **git add -A** +- `gp` - **git pull** +- `gc ` - **git commit -am ** +- `postpr` - **Done after a pull request is merged, switches to master and removes the pr branch and pulls** diff --git a/rc.zsh b/rc.zsh index e8a526c..377b2c9 100644 --- a/rc.zsh +++ b/rc.zsh @@ -1,5 +1,6 @@ # 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 @@ -28,6 +29,12 @@ postpr() { echo "Switched to master, pulled latest, and deleted branch $current_branch" } +gpr() { + git checkout -b $1 + git push origin $1 + git branch -D $1 +} + gc() { git commit -am $1 } From 702ae81d3b0349ee2765c9257b87e757f1c5f686 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 8 Feb 2026 03:45:14 +0100 Subject: [PATCH 3/3] gpr forgot to switch to master first --- rc.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/rc.zsh b/rc.zsh index 377b2c9..d577bf4 100644 --- a/rc.zsh +++ b/rc.zsh @@ -32,6 +32,7 @@ postpr() { gpr() { git checkout -b $1 git push origin $1 + git checkout master git branch -D $1 }