Skip to content

Instantly share code, notes, and snippets.

@muellerzr
Created January 24, 2021 05:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save muellerzr/1da8985f488ddd11719b7e7cac89117e to your computer and use it in GitHub Desktop.
Save muellerzr/1da8985f488ddd11719b7e7cac89117e to your computer and use it in GitHub Desktop.
Make a new pr from an existing cloned repository by simply doing `make_pr`
#!/bin/bash
echo "Setting up a new PR"
# Ask for username
echo "Please enter the original GitHub organization or username of the repository (the part of the URL after github.com/): "
read org
# Ask for repo
echo "Please enter the repository name: "
read name
#Ask for branch
read -e -p "Please enter the branch of the repository you wish to use: " -i "main" branch
git remote add upstream https://github.com/$org/$name
git remote update
git checkout upstream/$branch
#Ask for new branch name
echo "Please enter a new branch name to use: "
read new_branch
git checkout -b $new_branch
@muellerzr
Copy link
Author

To use, copy this into your /bin/ directory, and then run make_pr in an active git repository you want to use that is out of sync with the master/main branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment