Gits and Giggles – Getting onto Github from Mint

“Github ?” said Deb, “sounds like a chat room for grumpy old men. You should fit right in !”
To be fair, neither of us were in a particularly good mood at the time.
Deb had just been made to sit through the Rugby World Cup Final whilst my emergency backup nationality had finally born fruit.
All I said to her was that it’s nice to be able to support a real country rather than a mere principality, like Wales. Honestly, some people are so touchy.

For my part, I had just discovered that Github, based on the Git source control system written by Linus Torvalds himself, has integrated clients for Windows and Mac, but not for Linux.

No matter. If you want to interact with Github, you’ll need to have Git installed on your client machine anyway and, mine being Linux, there are a number of GUIs available for Git.

Aside from the Git documentation itself, which is extensive, there are a number of excellent guides to both Git and Github available.
Rather than re-hashing these – although I will link some of them – I’m going to look at things from a slightly different perspective.

Throughout my career, I’ve been, first and foremost, a database developer.
Way back when, choices of version control systems were rather limited. In a professional sense, I grew up with PVCS and Visual Source Safe.
Even later on, the fact that Oracle Forms and Reports were binary source code meant that the Edit-Merge paradigm of source control was something that tended not to gain traction in the Oracle Shops that I worked in.

Later on, in larger organisations, Perforce was the tool of choice, although always with the comforting P4Win ( and later P4V) front-end.

So, I’d rather like the comfort of a GUI, if only to see that the files I think I’ve checked in are actually there.

Additionally, Github uses an enhanced version of the Markdown language for text files. It would be nice to be able to preview these files before uploading them to the repository.

First things first then….

Installing and Configuring Git

Installation is simple enough, I’m running on Mint so…

sudo apt-get install git

…does the job.

The first things to configure are all about you…

git config --global user.name "mike"
git config --global user.email "mike@somewhere.com"

Additionally, I’d quite like to use Gedit, rather than the default Vim, as my editor…

git config --global core.editor gedit

Once all that is sorted out, the next step is to create a repository.
There’s a very comprehensive guide to setting up git and getting on Github by Rob Krul here.

Code School also an excellent, interactive tutorial introduction to to Git.

Choosing a GUI

Unsurprisingly, you have a number of choices, some of which are listed here.

Initially, I was tempted by Git-Cola, if only for the opportunity it offered to work some Kool Aid gags into this post.
In the end though, I found that I was most comfortable with Giggle. Well, I’m game for a laugh…

Installing Giggle

Once again, giggle should be in the repositories…

sudo apt-get install giggle

There are also a couple of plugins available for giggle so…

sudo apt-get install giggle-personal-details-plugin giggle-terminal-view-plugin

Having a chuckle with Giggle

At this point, I’m assuming that you’ve created your Git repository and may or may not have set up your Github account.
For me, the repository I’m using is under my home directory in :

/home/mikes/crudo

On Mint 17 (with the Cinnamon desktop), giggle has appeared in the Programming menu.
The first time you fire it up, you should see this :

giggle1

To start with, swallow your disappointment and maximize the Window.

Now from the Project Menu, select Open and then point to the directory where you’ve created your git repository.

You should now see a tree view of the files in your project :

giggle2

Navigating to a file will allow you to see a Preview :

giggle_preview

And if you want to edit a file :

giggle_edit

In this case, I’m editing README.md which is a markdown file. Obviously, amending this file in a text editor is going to be prone to error given the nature of markdown. Fortunately, there is a way of reviewing your markdown changes before commiting them to the repository. I’ll come onto that in a bit.
In the meantime, however, I’m going to make a small change to this file

changing_readme

After saving these changes, if we now return to giggle and hit the Refresh button, we can see that the icon for README.md has changed :

changed_files

This is because we now have a change to the file. If we want to check the status of the change in git, we can simply open a terminal window from Giggle.
To do this, select the View menu and then Create Terminal.

The terminal will open in the location that’s currently in context in giggle.
We can now check the status with a standard Git command :

giggle_terminal

After closing the terminal window, we can switch to the history view, and review the change we’ve made. To do this, click the History button (next to the Browse Button on the button bar at the top of the window) :

giggle_history

If we wanted to, we could now commit this change by going back to the file browser, right-clicking the file we’ve changed and selecting Commit Changes :

giggle_commit

A Window will then pop-up for us to enter a comment :

giggle_comment

If we now hit the Commit button, the change will be saved to the repository.

There’s probably a bit more to discover about giggle. For now though, I’ve got enough to be getting on with.

As mentioned previously, Github uses markdown as it’s preferred language for text files. README.md is normally the first file you’ll create a Github repository with.
It also has it’s own extensions to this language.

You can find an introduction to markdown here.

If you want to check what your markdown file will look like prior to uploading to Github, help is at hand.

Getting a grip with a Github Markdown Previewer

Hosted on Github itself, Grip is a Github Readme Instant Previewer.

There are a couple of things you need to do before you can get a Grip.

First of all, you need to have Python installed.

This being Linux, there should be no problem there.
If you want to check…

python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Next, you need to have pip….

sudo apt-get install python-pip

…and you’re ready to proceed with grip…

sudo pip install grip

You should get the usual reams of output ending with…

Successfully installed grip docopt Flask itsdangerous Jinja2 Markdown MarkupSafe path-and-address Pygments requests Werkzeug
Cleaning up...

Now to view our file. Easiest way is to open a Terminal from Giggle with our file in context. This ensures we’re in the correct directory.
We can now simply launch grip :

grip
 * Running on http://localhost:6419/ (Press CTRL+C to quit)

If we now open a browser at the specified address, we can see what our markdown file will look like on Github :

preview_md

Any links you have to other files in your repository should still work as Grip supports relative paths.
If you want to make any edits to your files, you can do so then simply refresh your browser view.
Alternatively, you can stop grip ( with CTRL+C), edit and save your file then run it again.

With the aid of Grip and Giggle, I’ve now managed to upload my first Github project.

Now the Rugby World Cup is over, I suppose I’ll have to go back to supporting England. Mind you, as any Welsh readers will be quick to point out, England isn’t a proper country either.

Advertisements

2 thoughts on “Gits and Giggles – Getting onto Github from Mint

  1. Like you, I have mainly Oracle development background. I starterd to love the Community Edition of IntelliJ as a code editor, project navigator and GIT integration tool.
    It has a great plugin for GIT, support for markdown and many many more. And IntelliJ runs on Win/Mac and Linux/Unix.
    I also use RubyMine (personal license) at home, when working on my community projects where I use mixture of Oracle an Ruby (ruby-plsql) for unit testing.
    The licensed version has lots of goodies, but it’s worth just giving a try to the Community for a start.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s