Blog

Git and GitHub (for a Scala Hack Session) – Setup

There is a great colleague of mine having an enumerous number of notes about everything he has been working and researching on: Linux, Scala, mathematical algorithms, NoSQL, Clustering, Security etc. Recently he and I attended two online courses about Scala’s functional and reactive programming. While attending both courses he and I have discussed, researched, and created a lot of code examples in form of Scala worksheets.

These courses are also known as Massive Open Online Courses (MOOCs):

Source: MOOC, every letter is negotiable
The idea about making education available and know-how sharing to everyone is great. I have set up a Scala Hack Session based on worksheet exercises for sharing them with my colleagues and other developers. This way I can contribute and get feedback as well.

GitHub – as a “social coding platform” – is ideal for such a purpose.

Intro: Git and GitHub – Tooling your Software Workflow and Development Life Cycle


Source: Dictator and Lieutenants Workflow

In my other blog about Git and GitHub: Tooling your Software Workflow and Development Life Cycle I have outlined that a Source Control Management (SCM) tool is not just a tool but it plays an important role in our daily business in software development. Similar to software design where we differ between “Modules being Design in the Large” and “Objects being Design in the Small” in the software development we define “Workflows as Work in the Large” and “Tasks as Work in the Small”.

In Scrum for example this would be planning User Stories from the Product Owner’s backlog for the next Sprint. A planned Sprint Backlog contains tasks where developers select one or more tasks for today. Every morning in our Daily Scrum we discuss about the progress regarding the current Sprint. There are excellent tools for this – like Jira going beyond than a primitive issue tracker (you name it, like Bugzilla). For Open Source developers many tools are even for free.

Git as a de-centralized SCM tool allows us a lot of flexibility: create a local repository, clone (locally) from a remote repository, push and pull from other repositories, branch and merge between different versions, and many other things. GitHub goes a step further and encourages us developers not only to contribute but also interact with other developers through our published code.

Based on my Scala Hack Session on GitHub I will guide you through these main steps:

  1. Forking a GitHub project and setting up your local Git
  2. Local coding with Egit and pushing your forked project
  3. Social Coding with GitHub

This part covers the setup of Git and GitHub using the Eclipse plugin Egit. In the next blog you learn how to work with your local repository and keeping it in sync with your remote repository on your GitHub account. In the last part you will then learn how to contribute your changes back to the original repository.

Setup

This blog focuses on the socal coding part. In case you have not yet registered to GitHub now it is the perfect time. I will show you how to work through all within an IDE instead of using extra tools or command lines.

Here are some introductions if Git and GitHub are new to you:

Fork the Scala Hack Session into your own GitHub repository
Forking is a way to contribute to somebody’s project. Open the GitHub project on your preferred browser and click “Fork” at the top right.

Source:GitHub Help>Fork A Repo
You should now have your own repository “https://github.com/myusername/scala-hack-session” like this:

EGit plugin for Eclipse
Assuming you have the Eclise-based Scala IDE installed you can use this update URL: http://download.eclipse.org/egit/updates.

In case the Git command groups are not shown on your IDE do the following: Go to Window > Customize Perspective and select the Git command group in the tab “Command Groups Availability”.

In your Scala IDE you will have then immediate access to the most common Git commands:

Clone your repository to your local Git repository
In your IDE select File > Import… > Git > Projects from Git > Clone URI and enter into the URI field your forked URL: https://github.com/myusername/scala-hack-session

Click next, select the master branch, next, select the directory where it should be cloned on your local machine, and press next. Now you have a local Git repository where you can work on:

Click next again, “Import existing projects”, select all projects shown there, and click finish.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *