Github being the world's biggest code hosting platform is also an OSS powerhouse. Their most under popularised creation is hub.
According to the official website, "hub helps you win at git". I'll be covering the installation and use below, and we shall see if we win or not ;)
Installation
Installation is clean and easy. Download the latest release from http://ift.tt/1wL9ls9 and unzip the archive. You should see the following files
Executing a simple ./install will install the hub binary, the man pages, and the hub+git bash completion script. You need to do one additional step before you're ready to use hub. Add alias git=hub to your .bashrc and then save it. Now every new terminal is ready to use hub, by using our good old git invocation.
Before adding the alias :
After adding the alias:
You will see the second code snippet has some additional commands listed. We'll be going over all of these shortly.
Functionality
hub lets you simplify your clone commands. To clone your own repos, just specify the repo name, as in git clone local_manifests
To clone someone else's repo, just add the username to it
All standard switches are supported as well, so you can pass -b cm-13.0 with the clone command.
hub also makes forking a very easy task, simply type git fork in a cloned repository's folder
git fork --no-remote will fork the repo but will not add a remote as it did in the earlier example.
Another powerful feature of hub is the ability to create Pull Requests from the terminal. Here you can see me adding a commit to @regalstreak's automated ROM source compression script
I pushed this commit to my fork of the repo (I could have pushed directly as well, I'm a contributor ;) ). Now we'll see how to start a PR from MSF-Jarvis/skadoosh to regalstreak/skadoosh, from the terminal.
To start a PR, use the following command
This command brings up a PR message editor that behaves much like the commit message editor we see all the time. Fill in and hit enter :)
create lets you, umm, create a new github repository from the current local repository. create also accepts some flags, which you'll see below
the 'hub-rocks' at the end is the repository name, which defaults to the current directory name, and goes up the folder structure until a folder name is found that does not match the name of an existing repository.
The created repo
browse lets you visit specific pages of any repo
will open the commits view of my device tree repo for seedmtk
will show the PRs on @regalstreak's skadoosh repo, and so on.
compare is a pretty straight-forward command, to show a webpage with the diff between two tags, commits, or branches or a permutation of both.
will compare the lolita and lol2 branches on my fork of regalstreak/skadoosh
release lets you create a new release on your repository and also adds tags, and uploads assets.
Which results in
issue works in a similar way
Result
ci-status will show the Travis-CI response code for the latest commit on the repo and may return one of, success, pending, failure. On repos where CI has not been enabled, this returns a 404.
This is just a minor introduction to the things hub can do for you. Play around, and you'll find some more hidden goodies ;)
According to the official website, "hub helps you win at git". I'll be covering the installation and use below, and we shall see if we win or not ;)
Installation
Installation is clean and easy. Download the latest release from http://ift.tt/1wL9ls9 and unzip the archive. You should see the following files
Code:
.:
bin etc install LICENSE README.md share
./bin:
hub
./etc:
hub.bash_completion.sh hub.zsh_completion README.md
./share:
man
./share/man:
man1
./share/man/man1:
hub.1 Before adding the alias :
After adding the alias:
You will see the second code snippet has some additional commands listed. We'll be going over all of these shortly.
Functionality
hub lets you simplify your clone commands. To clone your own repos, just specify the repo name, as in git clone local_manifests
Code:
harsh@jarvis:~$ git clone local_manifests
Cloning into 'local_manifests'...
remote: Counting objects: 69, done.
remote: Total 69 (delta 0), reused 0 (delta 0), pack-reused 69
Receiving objects: 100% (69/69), 8.55 KiB | 0 bytes/s, done.
Resolving deltas: 100% (23/23), done.
Checking connectivity... done.
harsh@jarvis:~$ cd local_manifests/
harsh@jarvis:~/local_manifests$ git remote -v
origin git@github.com:MSF-Jarvis/local_manifests.git (fetch)
origin git@github.com:MSF-Jarvis/local_manifests.git (push) All standard switches are supported as well, so you can pass -b cm-13.0 with the clone command.
hub also makes forking a very easy task, simply type git fork in a cloned repository's folder
git fork --no-remote will fork the repo but will not add a remote as it did in the earlier example.
Another powerful feature of hub is the ability to create Pull Requests from the terminal. Here you can see me adding a commit to @regalstreak's automated ROM source compression script
I pushed this commit to my fork of the repo (I could have pushed directly as well, I'm a contributor ;) ). Now we'll see how to start a PR from MSF-Jarvis/skadoosh to regalstreak/skadoosh, from the terminal.
To start a PR, use the following command
Code:
harsh@jarvis:~/skadoosh$ git pull-request -h MSF-Jarvis:lolita -b regalstreak:lolita
http://ift.tt/2cnE4gT create lets you, umm, create a new github repository from the current local repository. create also accepts some flags, which you'll see below
Code:
harsh@jarvis:~/hub-rocks$ git status
On branch master
nothing to commit, working directory clean
harsh@jarvis:~/hub-rocks$ git create -p -d "Super secret stuff here" hub-rocks
Updating origin
created repository: MSF-Jarvis/hub-rocks
harsh@jarvis:~/hub-rocks$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 897 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:MSF-Jarvis/hub-rocks.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin. The created repo
browse lets you visit specific pages of any repo
Code:
git browse MSF-Jarvis/android_device_google_seedmtk commits Code:
git browse regalstreak/skadoosh pulls compare is a pretty straight-forward command, to show a webpage with the diff between two tags, commits, or branches or a permutation of both.
Code:
harsh@jarvis:~/skadoosh$ git compare -u MSF-Jarvis lolita..lol2 release lets you create a new release on your repository and also adds tags, and uploads assets.
Code:
harsh@jarvis:~/git-repos/reg-api$ git release create -a app.py v1.0
Uploading assets (1/1)
http://ift.tt/2cnE1Sn issue works in a similar way
Code:
harsh@jarvis:~/git-repos/reg-api$ git issue create -m "No authorisation enforced on endpoints" -l BUG,Will\ be\ fixed,Enhancement
http://ift.tt/2cnDSyl ci-status will show the Travis-CI response code for the latest commit on the repo and may return one of, success, pending, failure. On repos where CI has not been enabled, this returns a 404.
This is just a minor introduction to the things hub can do for you. Play around, and you'll find some more hidden goodies ;)
from xda-developers http://ift.tt/2cnDJee
via IFTTT
No comments:
Post a Comment