Skip to content
Snippets Groups Projects
Verified Commit c454e686 authored by Lukas Kluft's avatar Lukas Kluft
Browse files

Apply review suggestions

parent eb1aeb3f
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,9 @@ author: "Lukas Kluft and Georgiana Mania"
# Version control systems
There are many version control systems out there (e.g. Subversion, CVS, Mercurial). We will focus on [Git](http://git-scm.com) which is the **de facto standard**
![](https://git-scm.com/images/logos/downloads/Git-Logo-2Color.svg "Git logo"){height=10%}
* Manage a sequence of snapshots (e.g. of folders)
* Provide tools to handle changes
* Provide tools for collaboration
## Why version control?
......@@ -21,6 +21,12 @@ There are many version control systems out there (e.g. Subversion, CVS, Mercuria
* **Backup** _I replaced the wrong my_file_2_final_final.py_ 😱
:::
## Git
There are many version control systems out there (e.g. Subversion, CVS, Mercurial). We will focus on [Git](http://git-scm.com) which is the **de facto standard**
![](https://git-scm.com/images/logos/downloads/Git-Logo-2Color.svg "Git logo"){height=10%}
## As easy as **1, 2, 3**
```bash
git init . # Initialize a repository
......@@ -28,6 +34,27 @@ git add . # Add the whole directory content (don't do that)
git commit -m "Initial commit" # Commit your changes
```
```{mermaid}
gitGraph
commit id: "df21a: Initial commit"
```
## Sequence of snapshots
Commits are linked to form a sequence of snapshots:
```bash
echo "hello" > world.txt
git add world.txt
git commit -m "add world"
```
```{mermaid}
gitGraph
commit id: "df21a: Initial commit"
commit id: "315f2: add world"
```
## The basic workflow
* Git offers plenty of functionality that is extensively documented
......@@ -187,10 +214,11 @@ gitGraph
commit
checkout main
branch bob
checkout main
merge alice
checkout bob
commit
checkout main
merge alice
merge bob
```
......@@ -242,7 +270,7 @@ Commits should deal with only one task; one logical unit
* Ensure regular commits to track progress effectively
* Commit each fix or task independently for clarity and easier management
* Commit only when a significant portion of work is completed
* Commit self-consistent (i.e. working) states
## Best practices {visibility="uncounted"}
......@@ -353,7 +381,7 @@ gitGraph
:::
::::
Rebasing retains a linear history by **changing the commit history (!!!)**
Rebasing retains a linear history<br/> by **changing the commit history (!!!)**
## Forks
......@@ -372,3 +400,10 @@ Rebasing retains a linear history by **changing the commit history (!!!)**
VSCode, meld
# Further reading
* [The official git documentation pages](https://git-scm.com/doc)
* [Introductions by GitLab](https://university.gitlab.com/pages/getting-started)
* [Software Carpentry on git](https://swcarpentry.github.io/git-novice/)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment