From fa90f69e034152f9d94985eb3835800155828b29 Mon Sep 17 00:00:00 2001 From: ajinkyab03 Date: Mon, 21 Oct 2024 13:04:35 +0530 Subject: [PATCH] ADDED PPR CUSTOME COMMAND --- commands/ppr/README.md | 20 ++++++++++++++++++++ commands/ppr/ppr.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 commands/ppr/README.md create mode 100644 commands/ppr/ppr.sh diff --git a/commands/ppr/README.md b/commands/ppr/README.md new file mode 100644 index 0000000..4235d56 --- /dev/null +++ b/commands/ppr/README.md @@ -0,0 +1,20 @@ +# Project Name + +This project includes custom scripts that automate frequently used Git commands. Below, you will find information about the `ppr` command which simplifies the Git workflow. + +## ppr + +### Description +The `ppr` command automates the process of pushing changes, pulling the latest updates, and rebasing your branch with the remote `main` branch. It combines three commonly used Git commands into one, streamlining your workflow: + +```bash +git push origin main +git pull origin main +git rebase origin/main + +``` +instead of all above just run following +``` +./ppr.sh + +``` diff --git a/commands/ppr/ppr.sh b/commands/ppr/ppr.sh new file mode 100644 index 0000000..118db42 --- /dev/null +++ b/commands/ppr/ppr.sh @@ -0,0 +1,29 @@ +#!/bin/bash + + +echo "Pushing changes to origin/main..." +git push origin main + + +if [ $? -eq 0 ]; then + echo "Changes successfully pushed to 'main' branch." +else + echo "Error: Failed to push changes." + exit 1 +fi + + +echo "Pulling latest changes from origin/main..." +git pull origin main + + +echo "Rebasing with origin/main..." +git rebase origin/main + +if [ $? -eq 0 ]; then + echo "Push, pull, and rebase process completed successfully!" +else + echo "Error: Rebasing failed." + exit 1 +fi +