- Generate a GitHub Access Token with
repo:statusaccess. - Put
gitpr.pyin a scripts directory (I use~/scripts/python/) and update it with your github access token. - Save
gitpras/usr/bin/gitprand make it executable (chmod +x /usr/bin/gitpr). Then update the value ofscripts_dirto the directory you savedgitpr.pyin. - Optional: Install pyperclip with
sudo pip install pyperclip. If pyperclip is detected, the link to the Pull Request on GitHub will be copied to your clipboard. - Optional: if you are using a repository that takes Pull Requests at a branch other than master, you will have to add the repository to the
target_branchesdict with the repo as the key and the target branch as the value. See the code for an example.
- Fork a repository on GitHub
git cloneyour forkcdto cloned repo directorygit remote addthe original repository- Make changes and commit
- Run
gitpr
It will push your changes to your fork, then submit a pull request from your fork to the original repository.
ex. Fork https://github.com/atom/atom
git clone git@github.com:Cabloo/atom.git
cd atom
git remote add original_repo git@github.com:atom/atom.git
touch testfile.txt
git add testfile.txt
git commit -m 'This will be the commit message and the title of the pull request'
gitpr
Setup:
repo:statusaccess.gitpr.pyin a scripts directory (I use~/scripts/python/) and update it with your github access token.gitpras/usr/bin/gitprand make it executable (chmod +x /usr/bin/gitpr). Then update the value ofscripts_dirto the directory you savedgitpr.pyin.sudo pip install pyperclip. If pyperclip is detected, the link to the Pull Request on GitHub will be copied to your clipboard.target_branchesdict with the repo as the key and the target branch as the value. See the code for an example.Usage:
git cloneyour forkcdto cloned repo directorygit remote addthe original repositorygitprIt will push your changes to your fork, then submit a pull request from your fork to the original repository.
ex. Fork https://github.com/atom/atom