extra git docs

This commit is contained in:
2025-01-28 09:46:19 +01:00
parent 54c2b78de6
commit 4051b36949

View File

@@ -24,6 +24,28 @@ Once you run that it outputs a key. That key is your public ssh key. You can sha
Now you can register the key that got output in the console on the gitlab server. First click your profile picture in gitlab and then go to edit profile. Now you have a menu bar on the left, there you can click the SSH Keys tab and register your ssh key. After you have done that you can push and pull from your gitlab repository.
## Cloning the repository
To clone a git repository you need a link to the repository. How
To clone a git repository you need a link to the repository. When you press code on your project home you will see multiple links pop up. You will need the link that starts with `git@` and copy the entire link
TODO: finish this
Now you can go back to your console and type `git clone <link>` and then press enter. It will prompt you to trust the fingerprint of the server. When you've accepted that you have the repository on your local machine!🎉
## Git commands
When you're working on your project you need to make commits and push to the server so your work is also stored over there. There are a few commands you need to use for that.
| Git command | Description |
|-------------------------------- |------------------------------------------------------------ |
| git clone <link> | clones a remote repository from the server to your machine |
| git add <file> | stages a file to be committed |
| git commit -m "commit message" | commits all staged files with the commit message |
| git push | sends all the committed files to the remote server |
Git workflow:
```mermaid
graph LR
A[Work on your project] --> B[Stage your project files]
B --> C[Commit the files with a message]
C --> D[Push]
```
## Extra notes
Write clear commit messages because when you wanna return to a older version it's nice to know what changed since that commit.