Skip to content
Frederic Vogels edited this page Feb 28, 2022 · 7 revisions

Git Repository

This exercise backed by a git repository. Technically, it is 100% superfluous: you can get through this tutorial without retrieving the repo at all: simply start a new project in Visual Studio and follow the steps.

What, then, is the use of this repository? It can help out you when you're stuck. This tutorial lets you write a simple GUI application in steps. We have performed these steps ourselves (so as to make sure everything works as intended) and at regular times, we took "snapshots" of the current state of code using git. In other words, you can use git to retrieve such a snapshot, effectively asking "What should my code look like at this point in the guide?"

In order to demonstrate this, we need you to first download the full git repository. Start by choosing a parent directory in which to store it. Git will take care of creating a subdirectory. Open Git Bash in this parent directory. For example, say you wish to store it at D:\School\VGO\temperature-converter, you need only create D:\School\VGO and open Git Bash there.

In the Git Bash shell, enter the following command (omit the $: it serves only to indicate that what follows is something you're supposed to write in the shell).

$ git clone https://github.com/ucll-vgo/vgo-temperature-converter.git temperature-converter

This command asks git to download the repository stored at the given url into a new directory temperature-converter. Feel free to use another name if you wish.

Enter this newly created directory.

$ cd temperature-converter

You can ask for the repository's status. Only enter the first line (git status). The following lines represent the feedback you should get. If you don't get something similar, something went wrong and you should ask for help.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Right now, this directory contains the final code of the project. You can open the TemperatureConverter.sln file in Visual Studio if you wish, build it and run it.

We will now ask git to 'go back in time'. As mentioned before, we made several snapshots during the development of the project, including one at the very beginning. We called this snapshot start. Jumping back to this early snapshot is done with the following command:

$ git checkout start

Let's now create a separate 'timeline' for you to work on. You will write your own code in this 'alternative universe'. In git terminology, this is called a branch. We create a branch called student as follows:

$ git branch student

This has merely created the branch. We still need to switch to this branch.

$ git checkout student

Asking for the status will now yield a different result:

$ git status
On branch student
nothing to commit, working tree clean

(Ignore this)

  • TODO Example of peeking into original timeline
  • TODO Remove empty-project tag, it has been replaced by start
Clone this wiki locally