Skip to content
Snippets Groups Projects
Commit 65073ba3 authored by LarsZauberer's avatar LarsZauberer
Browse files

Practical Usage section

parent 8c9ce7cf
No related branches found
No related tags found
No related merge requests found
Showing
with 297 additions and 1 deletion
......@@ -36,6 +36,7 @@ Foss: Free and Open Source Software
- Slides on the website
- Transkript on the website
- Questions at any time
- We have theoretical and practical time
## What is Git?
......@@ -46,11 +47,13 @@ What is Git?
## What is Git?
\begin{center}
Git is the best \textbf{Source Control Software} out there
Git is the most popular \textbf{Source Control Software} out there
\end{center}
## Source Control
## Source Control
\begin{center}
\includegraphics[width=0.7\textwidth]{img/git_usecase_1.png}
\end{center}
......@@ -73,6 +76,8 @@ Git is the best \textbf{Source Control Software} out there
\includegraphics[width=0.7\textwidth]{img/git_usecase_4.png}
\end{center}
## Collaboration
## Short History
## Short History
......@@ -400,6 +405,34 @@ and download git there.
\includegraphics[width=5cm, right]{img/git_website.png}
\end{center}
## Installation: Git on Mac
Installing Homebrew in the terminal
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
Then run
`brew install git`
## Installation: Git on Linux
Install it with your package manager
Examples:
Ubuntu/Mint/Debian:
`sudo apt install git`
Fedora:
`sudo dnf install git`
Arch:
`sudo pacman -S git`
## Setup: Git
## Setup: Git
......@@ -542,6 +575,269 @@ Paste the key here
\textbf{We are ready!}
\end{center}
##
\begin{center}
\textbf{We are ready!}
Now, it's your turn
\end{center}
## Installation and Setup Summary Page:
- Go to \textbf{https://git-scm.com/downloads}
- Run the first command series on the right
- To to your gitlab page, login
- Go to the ssh key settings page
- Generate an SSH Key (second command)
- Copy the SSH Key (third command)
- Paste the key into GitLab
\begin{textblock}{5}(10, 3)
\includegraphics[width=5cm]{img/command_git_config.png}
\end{textblock}
\begin{textblock}{5}(10, 5.5)
\includegraphics[width=5cm]{img/command_ssh_keygen.png}
\end{textblock}
\begin{textblock}{5}(10, 9)
\includegraphics[width=5cm]{img/command_cat_key.png}
\end{textblock}
# Pratical Usage
##
\begin{center}
\textbf{Practical Examples}
\end{center}
## What we will do
- Create a git repository
- Learn basic git commands
- Add some files to git
- Push the files to GitLab
- Visit an old commit
- Create a branch
## Creating a git repository
## Creating a git repository
- Go to GitLab Main Page (Projects Tab)
- Create a new project (Create a blank project)
- Give it a name. Select for the namespace "your account"
- You choose the visibility (since it is a testing project you can keep it to private)
- Click on create project
## Creating a git repository
\begin{center}
\includegraphics[width=0.7\textwidth]{img/gitlab_create_project.png}
\end{center}
## Creating a git repository
Copy the \textbf{ssh} link
from the \textbf{code dropdown}
\begin{textblock}{8}(7, 3.5)
\includegraphics[width=8cm]{img/gitlab_clone_ssh.png}
\end{textblock}
## Creating a git repository
- Open Git Bash in an directory where you want to put the project folder into
\begin{textblock}{10}(7, 3)
\includegraphics[width=0.7\textwidth]{img/command_clone.png}
\end{textblock}
## Creating a git repository
- Use \textbf{cd} to get into the project directory (it is called how you called it in gitlab)
\begin{textblock}{5}(9, 1)
\includegraphics[width=0.7\textwidth]{img/command_cd_repo.png}
\end{textblock}
## Creating a git repository
\begin{center}
You have created your first git repository
\end{center}
## Basic Git Commands
## Basic Git Commands
Most important one:
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_git_status.png}
\end{center}
## Basic Git Commands
Most important one:
\begin{center}
\includegraphics[width=0.5\textwidth]{img/command_output_git_status_1.png}
\end{center}
## Basic Git Commands
Viewing the Git History:
Just press \textbf{q} to exit the command.
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_git_log.png}
\end{center}
## Basic Git Commands
Viewing the Git History:
Just press \textbf{q} to exit the command.
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_output_git_log.png}
\end{center}
## Adding Files
## Adding Files
Go into the repository (can be with your normal file explorer) and change something in there.
Example Changes:
- Create a file
- Change something in a file
- Delete a file
\textbf{Warning:} Adding an empty directory is not enough.
## Adding Files
Rerun git status and see what happens
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_git_status.png}
\end{center}
## Adding Files
Rerun git status and see what happens
\begin{center}
\includegraphics[width=0.7\textwidth]{img/command_output_git_status_2.png}
\end{center}
## Creating a Commit
\textbf{Staging Phase} (Selecting your changes):
\begin{center}
\includegraphics[width=0.6\textwidth]{img/command_git_add.png}
\end{center{}}
## Creating a Commit
Create the actual commit:
\begin{center}
\includegraphics[width=0.4\textwidth]{img/command_git_commit.png}
\end{center}
## Creating a Commit
Rerun git log and see your new commit
\begin{center}
\includegraphics[width=0.7\textwidth]{img/command_output_git_log_2.png}
\end{center}
##
\begin{center}
Congratulations you have created your first commit
\end{center}
## Visiting old commits
To visit old commits run this command with the first few digits of the commit hash
Observe that the change you made is \textbf{not there anymore}
\vspace{5cm}
\begin{textblock}{4}(2, 5)
\includegraphics[width=\textwidth]{img/command_checkout_commit.png}
\end{textblock}
\begin{textblock}{8}(6, 5)
\includegraphics[width=\textwidth]{img/command_output_git_log_2.png}
\end{textblock}
## Going back to the main version
Observe that the change you made is \textbf{back}
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_checkout_main.png}
\end{center}
##
\begin{center}
You see your data is now secured through git.
\end{center}
##
\begin{center}
You see your data is now secured through git.
Now, try for yourself
\end{center}
## Creating Branches
Create a branch by running the following command
\begin{center}
\includegraphics[width=0.4\textwidth]{img/command_checkout_branch_create.png}
\end{center}
## Creating Branches
- You can make changes now and observe if we switch to the main branch again that the changes are not there anymore.
- If we do changes to main are the changes in our new branch not affected.
## Switching Branches
Default main Branchname is "main"
Switch to a branch by checking out to the name. This will jump to the newest commit in the branch
\begin{center}
\includegraphics[width=0.3\textwidth]{img/command_checkout_branch_name.png}
\end{center}
##
\begin{center}
Now, you can work in isolation without interfering with your main version
\end{center}
# Extras
## Image Sources
......
No preview for this file type
new_git_and_gitlab/img/command_cat_key.png

66.2 KiB | W: | H:

new_git_and_gitlab/img/command_cat_key.png

63.1 KiB | W: | H:

new_git_and_gitlab/img/command_cat_key.png
new_git_and_gitlab/img/command_cat_key.png
new_git_and_gitlab/img/command_cat_key.png
new_git_and_gitlab/img/command_cat_key.png
  • 2-up
  • Swipe
  • Onion skin
new_git_and_gitlab/img/command_cd_repo.png

26.2 KiB

new_git_and_gitlab/img/command_checkout_branch.png

35 KiB

new_git_and_gitlab/img/command_checkout_branch_create.png

36.6 KiB

new_git_and_gitlab/img/command_checkout_branch_name.png

35 KiB

new_git_and_gitlab/img/command_checkout_commit.png

32.1 KiB

new_git_and_gitlab/img/command_checkout_main.png

31.7 KiB

new_git_and_gitlab/img/command_clone.png

45.6 KiB

new_git_and_gitlab/img/command_git_add.png

62.3 KiB

new_git_and_gitlab/img/command_git_commit.png

37.5 KiB

new_git_and_gitlab/img/command_git_config.png

80.6 KiB | W: | H:

new_git_and_gitlab/img/command_git_config.png

92.9 KiB | W: | H:

new_git_and_gitlab/img/command_git_config.png
new_git_and_gitlab/img/command_git_config.png
new_git_and_gitlab/img/command_git_config.png
new_git_and_gitlab/img/command_git_config.png
  • 2-up
  • Swipe
  • Onion skin
new_git_and_gitlab/img/command_git_log.png

26 KiB

new_git_and_gitlab/img/command_git_status.png

27.8 KiB

new_git_and_gitlab/img/command_output_git_log.png

121 KiB

new_git_and_gitlab/img/command_output_git_log_2.png

173 KiB

new_git_and_gitlab/img/command_output_git_status_1.png

75.1 KiB

new_git_and_gitlab/img/command_output_git_status_2.png

104 KiB

new_git_and_gitlab/img/gitlab_clone_ssh.png

101 KiB

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