Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Latest commit

 

History

History
145 lines (98 loc) · 4.71 KB

README.md

File metadata and controls

145 lines (98 loc) · 4.71 KB

gh-utils

Clojars Project Dependencies Status ClojarsDownloads

Clojure library designed to automate some useful git command without the need to use the web browser. Based on the tentacles library with sensible default. You can simply create new Github repo with one simple command and one config file. TL;DR; gh-utils --config ~/Dropbox/config/github.edn --repo my-awesome-idea --push

Installation and usage as command line interface (CLI)

Pre-requisites

Installation

# Clone this repository locally
mkdir -p ~/projects

git clone https://github.com/agilecreativity/gh-utils.git ~/projects/gh-utils

cd ~/projects/gh-utils

# Create the `~/bin` folder to hold the executable
mkdir -p ~/bin

# Generate the standalone binary using `lein bin`
lein bin

Once this is done you should be able to just run the command to see basic usage:

Create new Github's project from a command line

Usage: gh-utils [options]
  -c, --config CONFIG              ~/Dropbox/config/github.edn
  -r, --repo REPO
  -i, --init-commit
  -l, --remote-label REMOTE_LABEL  origin
  -p, --push
  -h, --help

Options:

--config       CONFIG       full path to the config file e.g. ~/Dropbox/config/github.edn
--init-commit               run git-init and git commit on the local project
--repo         REPO         name of repository to be created
--remote-label REMOTE_LABEL remote label default to 'origin'
--push                      push the code to the remote repository as well

Examples:

a) To push existing project that have already contain some commit (e.g. skip -i)
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -l upstream -p

b) To create and push brand new project to Github and run initial commit
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -i -l origin -p

c) To create brand new project to Github, run initial commit and skip pushing to remote branch.
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -i -l origin

Usage

You will need to create the simple edn configuration file. The file can have any name but the format must be something like:

I personally store this config file in the following location ~/Dropbox/config/github.edn

{:username "YOUR-GITHUB-ID"
 :password "YOUR-GITHUB-PASSWORD"}
  • To create a Github repository called my-awesome-idea only (no push is performed).
# long version
gh-utils --config ~/Dropbox/config/github.edn --repo my-awesome-idea

# short version
gh-utils -c ~/Dropbox/config/github.edn -r my-awesome-idea
  • To create initial commit locally and then push the same codes to Github
# long version
gh-utils --config ~/Dropbox/config/github.edn --repo my-awesome-idea --init-commit --push

# short version
gh-utils -c ~/Dropbox/config/github.edn --repo my-awesome-idea -i -p
  • To push local version of existing repository to new Github repository
# To create your repository in Github and push your changes to remote branch try
$gh-utils --config ~/path/to/github-config.edn --repo my-awesome-id --push

# Or using short form
$gh-utils -c ~/path/to/github-config.edn -r my-awesome-id -p

# Note without supplying -p the repository will be created remotely without initial git push

Now open https//github.com/<YOUR-GITHUB-ID>/my-awesome-idea in your browser.

Development

  • Leiningen
[org.clojars.agilecreativity/gh-utils "0.3.2"]

Related Links

Roadmaps & TODOs

  • Add the intial commit with README.md file touch README.md && git add README.md && git commit -m "Add README.md" && git push"
  • Make use of clj-jgit
  • Use newer version of tentacles
  • Allow override of default options like ':public', ':description', etc

License

Copyright © 2016-2018 Burin Choomnuan

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.