class: center, middle # Collaboration with git & Gitlab --- # Why to use _git_
--- # How to use _git_ - installing - work local - change & track --- # Installing _git_ Download *git* for your operating system from [https://git-scm.com/downloads](https://git-scm.com/downloads) --- # Creating a local repository open your `Git-Bash` create a new directory ```bash mkdir mywebsite ``` change into that directory ```bash cd mywebsite ``` turn this folder into a git repository ```bash git init ``` --- # Checking your local repository you check the status of your repository using ```bash git status ``` which should give you ```bash On branch master No commits yet nothing to commit (create/copy files and use "git add" to track) ``` --- # Change something & commit it In your folder `mywebsite` create a file `helloworld.html` with the conent ```html
Hello World!
``` check how git sees that file ```bash git status ``` which tells you that there are ```bash No commits yet Untracked files: (use "git add
..." to include in what will be committed) helloworld.html nothing added to commit but untracked files present (use "git add" to track) ``` --- # Change something & commit it so let's follow the advice and do ```bash git add helloworld.html ``` and then **commit** this change ```bash git commit -m 'add my first file' ``` you can always check everything you did with ```bash git log ``` ```bash commit 3b5616d1ba962e7a2e4af1f1bdd54f5d65d4e22d (HEAD -> master) Author: Oscan Openness
Date: Sun Jan 12 12:20:28 2020 +0100 add my first file ``` --- # Login to gitlab create an account if you have none --- # Create a gitlab project (1/2)
--- # Create a gitlab project (2/2)
--- # Finish setup gitlab create a password in the settings add an SSH key (optional)
--- # Finish local setup
(skip the `git init`, `git add .` and `git commit -m "Initial commit` steps) --- # Add a readme eplain your project for others and your future self
--- # Add a license everything you write has Copyright Copyright gives you exclusive rights (no one can use it without permission) use a license to define permissions for others MIT to allow usage without restrictions GPL to allow usage if basic freedom granted to users (many others)
--- # Install github desktop download from https://desktop.github.com/ then open your repository folder
--- # Pull changes download the changes made on gitlab
--- # Commit changes change your local file then preview the changes and then commit
--- # Push changes push the changes
--- # View history see the changes you've made in the past
--- # Introduction done! play around with in for yourself! we are here to answer questions. inspiration: - change two files but only commit one - revert some changes - add some of your document to git ressources: - https://education.github.com/git-cheat-sheet-education.pdf - https://git-scm.com/book/en/v2 in 30 Minutes we will start with advanced topics. --- # Advanced topics create branch & merge request create issue & mention it in commit fork & merge back into origin add different remotes use SSH key ---