Blog

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

There is a great colleague of mine, François Scheurer, 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 and know-how sharing available 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 the current day. 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 in a series of 5 blogs where you:

  1. Setup Git, GitHub, and the EGit plugin in your Eclipse IDE;
  2. Learn in a typical scenario about workflow basics like Git’s data structure and the importance of branches;
  3. Fork a GitHub project into your local Git, and work with a local clone with Egit;
  4. Understand GitHub and its social features like following developers, starting conversations through code in each commit or branch, or by creating pull requests for merging a forked project back to its originator; and finally you
  5. Get the missing link by understanding a remote repository and how it is linked to a local, cloned Git by using local and tracked remote branches.

This blog series goes a little further than the basics of Git. It is important to understand the power and key concepts like working with local and tracked remote branches to get full advantage of Git in your development process.

Another key part is GitHub. Even though I focus on GitHub as a platform for remote repositories you are free to use any other solution like setting another Git server as a remote repository. The difference compared to that is GitHub’s social features like following developers, liking/starring repositories, forking any public repository, creating teams as a organization for repositories, and collaboration features to start conversations through code, commits, and branches.

Setup

In case you have not yet registered to GitHub now it is the perfect time. I will show you how to work through all these steps within an IDE instead of using extra tools or command lines. For the ones who still prefer command lines: have a look at this excellent reference with great examples for many Git commands.

Here are some introductions if Git and GitHub in case they 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, enter the directory where the local Git repository should be cloned on your local machine, and press next:

Having ‘Import existing projects’ selected press next, make sure you have ‘Search for nested projects’ ticked, select all projects shown there, and click finish.

Now you have everything prepared to work with Git and GitHub. In the next part I explain you first about some Git basics before working with a local Git.

Kommentare

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *