{ "cells": [ { "cell_type": "markdown", "id": "0ebc94a5-bd10-48d0-9b6b-5c8720873d4f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Git vs Github\n", "\n", "## Learning Objectives\n", "- Differentiate between Git and GitHub and understand their distinct roles\n", "- Learn the basic functionality of Git as a version control system\n", "- Understand the concept of terminals and how to use them for Git operations\n", "- Explore the additional features provided by GitHub for collaboration and code sharing\n", "- Understand how GitHub supports managing project development and team collaboration \n", "\n", "\n", "## Git: our version control system of choice\n", "\n", "In the last episode we explained what version control systems are and why they\n", "are useful. This course teaches you the basics of using a particular version\n", "control system, called\n", "Git.\n", "\n", "Git is one of the most popular and relied-upon version control systems used\n", "today, both in research and commercially. Git is simply a piece of software that\n", "you run on your computer. You can use it\n", "directly from the command line, using the command `git`.\n", "\n", "### Terminals\n", "In this course we will work through examples with command line syntax that you would find on most Unix-style systems (MacOS or Linux). If you are using Windows and have followed the installation instructions, you will have installed _Git for Windows_. This comes with the _Git Bash_ program, which emulates a Unix Bash shell (e.g. it uses forward slashes `/` for path separators and comes with common Unix programs like `ls` for listing the contents of a directory). We recommend you use Git Bash to follow through the course. You can launch Git Bash by opening the Start menu and typing `Git Bash` to find the program.\n", "\n", "\n", "If you have Git installed\n", "on your machine, you can run it right now: open up a terminal and try running the following\n", "command:\n", "\n", "``` bash\n", "git --version\n", "```\n", "\n", "If you have Git installed, your output should look something like this (your\n", "version number may differ):\n", "\n", "``` output\n", "git version 2.25.1\n", "```\n", "\n", "Because Git is so popular, there is a lot of software that integrates with it,\n", "which can lead to confusion about exactly what Git is. For example,\n", "you may have used programs like Visual Studio Code, RStudio or PyCharm to write\n", "your code. These additionally provide graphical user interfaces to help\n", "developers interact with Git via 'point and click' while you work on code,\n", "giving developers a more 'integrated' experience. But it's helpful to remember\n", "that these programs are just using Git under the hood and that it's perfectly\n", "possible to use Git without these. Indeed, it's best _not_ to rely on these\n", "integrated facilities for using Git, because you may well come up against\n", "situations in your work where you need to use Git in environments which force\n", "you to use it at the command line, such as remote servers.\n", "\n", "Chances are that, at some\n", "point, you will want to share your work, either with collaborators as the code is developed or\n", "in order to publicise your work. On it's own, Git doesn't provide the means to\n", "do this — for that, you also need somewhere to host a 'remote' version\n", "of your code which others can access. Many web platforms have been created to\n", "provide this service. They use Git as the core version control technology, while\n", "providing additional layers of functionality to facilitate sharing and collaboration\n", "with other developers. Examples of these platforms include\n", "GitLab,\n", "Codeberg and\n", "GitHub.\n", "It is possible to use Git completely 'locally'; that is,\n", "without interacting over the internet with some remote service. This is\n", "perfectly fine if you just want to version control your own software project\n", "that you have no intention of sharing with anyone. \n", "\n", "\n", "## Managing collaboration with GitHub\n", "\n", "As well as teaching you the basics of using Git, this course will give you an\n", "introduction to using GitHub as a way of sharing your code and managing its\n", "development.\n", "\n", "In some ways, the naming of GitHub is unfortunate, because it could easily sound\n", "like it's Git but 'on the web'. But that's not really true and to think\n", "of it in these terms can lead to confusion, especially early on. Remember that\n", "_Git_ is a tool that software developers use as they write code on their machines.\n", "_GitHub_ is a web\n", "platform that makes it easy to share code and provides extra functionality to\n", "support teams of software developers in their collaboration. Taking an analogy\n", "from scientific research, Git is more\n", "akin to a lab book that a scientist might use day-to-day to record what they\n", "did that day, the results of experiments, etc., whereas GitHub sits more at the\n", "level of planning and project management that a Principal Investigator would do\n", "to ensure the project runs smoothly and everyone is kept on the same page. It\n", "should also be noted that GitHub is not a replacement for Git. In fact, you will\n", "typically interact with GitHub _via Git_ while you develop your code. \n", "\n", "The full suite of facilities that GitHub provides is multi-faceted and it is far\n", "beyond the scope of this course for us to cover all of it. We will focus on\n", "features that support:\n", "\n", "* Sharing your code within your development team and the wider world\n", "\n", "* Ways to keep track of proposed additions or improvements to a codebase (via\n", " GitHub _issues_) and to ensure significant changes to the codebase are\n", " integrated in a controlled way (via GitHub _pull requests_).\n", "\n", "If you feel somewhat hazy on exactly how Git and GitHub differ, then don't worry:\n", "this should become clearer as we go through the course. For now, the key thing\n", "to bear in mind is that they play different roles: Git for day-to-day\n", "record-keeping while writing code, and GitHub for sharing and collaborating with\n", "others.\n", "\n", "## Summary Quiz" ] }, { "cell_type": "code", "execution_count": 2, "id": "fd4824e3-e5b8-4cf7-87ff-ce52d68b14cd", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "remove-input" ] }, "outputs": [ { "data": { "text/html": [ "