Commit 8d764072 authored by Kevin Höllring's avatar Kevin Höllring
Browse files

Move important instructions to own lines

parent 8ee31be4
......@@ -11,7 +11,7 @@ Copying error codes to the search engine is usually a good starting point.
Please do not forget to remove aspects specific to your project like project names, specific file paths, e.g. before triggering the search as you might end up with no results in case of a too specific set of words.
## How to start with this introduction
The basic idea of this introduction is for you to create your own repository, copy the files within this repository to your own repository and then proceed to fiddle with the samples and attempt to solve the programming training tasks in `src/task_*.cpp` (Higher numbers require more intricate understanding of the programming concepts).
The basic idea of this introduction is for you to create your own repository, copy the files within this repository to your own repository and then proceed to fiddle with the samples and attempt to solve the programming training tasks in ```src/task_*.cpp``` (Higher numbers require more intricate understanding of the programming concepts).
### First you will require a gitlab account.
Proceed to the [FAU gitlab server](https://gitlab.cs.fau.de/) and login using your idm credentials.
......@@ -34,7 +34,9 @@ Copy those to a terminal window on your computer and run them.
Now that you have configured your git user information, you need to obtain a local copy of your empty project.
Go to a directory where you want git to create a subfolder containing the repository.
Then with a terminal in the directory of your choice, run the command
`git clone <repository_https_url>`
```git clone <repository_https_url>```
Where `<repository_https_url>` can be obtained by clicking on the blue "clone" button on your repository page.
There will be one link starting with "https://" in the modal window popping up.
Copy that one and use it instead of `<repository_https_url>` to trigger the copying process.
......@@ -48,16 +50,24 @@ If the command 'ls -al' displays a folder `.git` you should be in the right fold
### Obtaining the data from the official repository
We will now proceed to copy the files from this repository to your personal copy.
With a terminal open in the directory of the cloned repository, run
`git remote add vorlage https://gitlab.cs.fau.de/cp1_ws19/cpp_introduction`
```git remote add vorlage https://gitlab.cs.fau.de/cp1_ws19/cpp_introduction```
This will register this repository as a source for files with the name "vorlage".
Your own repository on gitlab should be registered as "origin".
To check that this is indeed the case, you can run
`git remote`
```git remote```
in order to list the registered remote repositories and
`git remote get-url <remote_name>`
```git remote get-url <remote_name>```
to display the url that remote is associated with.
To copy the files of this repository to yours run
`git pull vorlage master`
```git pull vorlage master```
You should see the files from this repository appear in the project's directory.
### Working on the program files and using the version control
......@@ -65,27 +75,30 @@ You can open the source files in "/src" with any text editor or a development en
I will be using "Code::Blocks" for my demonstrations.
Once you have changed a source code file and want to keep your changes save, you can use
`git add <file_path>`
```git add <file_path>```
in order to register the file for subsequent versioning.
The command
`git status`
```git status```
should give you an overview of which files are new, which have been removed and which have been changed.
All three types of changes can be registered for subsequent versioning via `git add`
All three types of changes can be registered for subsequent versioning via
```git add```
Make sure not to add any binary/compiled files as git is not good at keeping those files and it bloats your repository.
In case you ever accidentally add any file, you can revert the registration (not the actual changes to the file) via
`git reset <file_path_to_unregister>`
```git reset <file_path_to_unregister>```
If you have accidentally changed or deleted a file and would like to reset it to its last stored state, you need to use
`git checkout <file_path_to_restore>`
```git checkout <file_path_to_restore>```
Once you have registered all changed files that you would like to store, run
`git commit`
```git commit```
and enter a message describing the changes you performed.
This will be done using a command line text editor.
......@@ -103,7 +116,7 @@ A good practice would be to add and commit every smallest set of changes to the
If you want to protect your stored versions/commits from hard drive failure/loss or if you plan to cooperate with other people you will want to copy your changes back to the gitlab server.
You can always do that by running
`git push`
```git push```
and entering your credentials.
When running this command for the first time, git might recommend running an alternate version of this command to setup the repository even further.
......@@ -112,7 +125,7 @@ Any subsequent pushes can be run by just `git push`.
It might happen that git rejects your push due to changes on the server.
In that case you will need to retrieve the changes on the server using
`git pull`
```git pull```
first.
Git will attempt to unify your changes with the version on the server.
......@@ -133,11 +146,11 @@ You can even grant other people access to your code on the gitlab which should a
The default options for `git push` and `git pull` will only update your own version of the project and will only retrieve changes to your own gitlab repository.
If you ever wish to obtain changes introduced to other remote repositories such as this template repository ("vorlage") you can tell git to specifically look for changes there by calling
`git pull <remote_name>`
```git pull <remote_name>```
most likely
`git pull vorlage`
```git pull vorlage```
Merge conflict might still occur.
You can resolve them the same way that you resolve merge conflicts within your own project.
......@@ -175,7 +188,7 @@ In order to be executable by a computer, the program has to be translated into m
You can use the command
`g++ <source_code_file> -o <name_of_output_program> -std=c++11 -Wall -Werror`
```g++ <source_code_file> -o <name_of_output_program> -std=c++11 -Wall -Werror```
This tells the compiler (g++) where to find the source code and how to name the resulting program.
In case you omit the name of the output program the result will most likely be an executable file called "a.out".
......@@ -185,10 +198,10 @@ If your code does compile without these two options but does not compile with th
A sample invocation of the command:
`g++ src/sample_4.cpp -o sample_4 -std=c++11 -Wall -Werror`
```g++ src/sample_4.cpp -o sample_4 -std=c++11 -Wall -Werror```
And the sample program can then be run by calling
`./sample_4`
```./sample_4```
in the console.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment