mygithub
My GitHub productivity scripts
git publish - publish current branch to GitHub and creates a pull request
Install
Install via source:
git clone git@github.com:jayzeng/mygithub.git
cd mygithub
python setup.py install
Install via pip or easy_install (https://pypi.python.org/pypi/mygithub/)
(sudo) pip install mygithub
(sudo) easy_install install mygithub
Help & Usage
If you already have a GitHub API token, you can set it as environment variable. (See "Personal API Access Tokens" in https://github.com/settings/applications)
export GITHUB_API_TOKEN=<my-token>
gitpublish.py --help
usage: gitpublish.py [-h] [-b BODY] [-t TITLE] [--base BASE_BRANCH]
[--in-browser IN_BROWSER]
optional arguments:
-h, --help show this help message and exit
-b BODY, --body BODY Pull request body (in markdown)
-t TITLE, --title TITLE
Pull request title
--base BASE_BRANCH Base branch
--in-browser IN_BROWSER
Open created pull request in browser
Example
To create a new pull request
gitpublish.py -t 'gitignore' -b '## Check in gitignore'
You may choose not to open created pull request in browser
gitpublish.py -t 'gitignore' -b '## Check in gitignore' --in-browser n
If a pull request already exists, you can omit the arguments. It will push the new commits to the pending pull:
gitpublish.py
pushed to remote origin (git@github.com:jayzeng/mygithub.git)
A pull request already exists for <Head [jayzeng:prototype/publish]>.
url: https://github.com/jayzeng/mygithub/issues/2
issue: https://github.com/jayzeng/mygithub/pull/2
Dependencies
- GitPython (https://github.com/gitpython-developers/GitPython)
- github3.py (https://github.com/sigmavirus24/github3.py)