<h3id="why-version-control">Why version control?</h3>
<ul>
<lidata-marpit-fragment="1">Without version control, only one version of your code exists
<ul>
<lidata-marpit-fragment="2"><em>What happens when you realize you made a mistake and need to roll back changes you've made?</em></li>
</ul>
</li>
<lidata-marpit-fragment="3">You could use manual backups, or a cloud storage service
<ul>
<lidata-marpit-fragment="4"><em>What happens if two people connect to a cloud service and edit the same file?</em></li>
<lidata-marpit-fragment="5">Or maybe not even the same file... <em>What happens when you and your teammate have made changes to code and you need to combine your work into a single, working version?</em></li>
</ul>
</li>
<lidata-marpit-fragment="6">Version control handles all the problems above, and you can focus on the important part: programming!
<ul>
<lidata-marpit-fragment="7">You can even try out some big changes that break your software completely</li>
<lidata-marpit-fragment="8">If that doesn't work out, just roll back into the last working version!</li>
<lidata-marpit-fragment="1">Git <em>could</em> be used locally, but its usage is almost always combined with a developer platform — a remote storage service like <ahref="https://github.com/">GitHub</a>, <ahref="https://gitlab.com/">GitLab</a> or <ahref="https://bitbucket.com/">BitBucket</a>
<ul>
<lidata-marpit-fragment="2">These services can also double as a programming portfolio</li>
<lidata-marpit-fragment="2">These services can also double as a programming portfolio that can help getting hired into the industry</li>
<lidata-marpit-fragment="3">Commonly used in both open source and commercial projects</li>
</ul>
</li>
<lidata-marpit-fragment="4">In Buutti's trainings, GitLab is most commonly used</li>
<lidata-marpit-fragment="4">In Buutti's trainings, <em><strong>GitLab</strong></em> is most commonly used</li>
<lidata-marpit-fragment="1">Git is operated via the <em><strong>command line</strong></em>, a.k.a, the <em><strong>terminal</strong></em></li>
@ -145,11 +177,14 @@
<lidata-marpit-fragment="4">Linux, (also included in the Windows Git install): <em><strong>bash</strong></em></li>
</ul>
</li>
<lidata-marpit-fragment="5">We're using PowerShell, which can be accessed inside VS Code</li>
<lidata-marpit-fragment="5">We're using PowerShell, which can be accessed inside <ahref="https://code.visualstudio.com/docs/languages/powershell">VS Code</a> or <ahref="https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022">Visual Studio</a>
<ul>
<lidata-marpit-fragment="6">In VS Code, open/close terminal by pressing <em><strong>CTRL+Ö</strong></em> (in the Fin/Swe layout)</li>
<h3id="basic-commands-and-the-working-directory">Basic commands and the working directory</h3>
<ul>
<lidata-marpit-fragment="1">To do actions in Git, you don't press buttons, you write commands</li>
@ -171,13 +206,13 @@
<lidata-marpit-fragment="8"><em><strong>Note</strong></em>: <code>..</code> is a shorthand for to the parent directory, <code>.</code> for the current directory</li>
<h2id="extra-help-this-is-horrible">Extra: Help, this is horrible!</h2>
<ul>
<lidata-marpit-fragment="1">Do you feel more at home in graphical UIs?
<ul>
<lidata-marpit-fragment="2">There are also graphical user interfaces for Git like <ahref="https://www.gitkraken.com/">GitKraken</a>, <ahref="https://www.sublimemerge.com/">Sublime Merge</a> or <ahref="https://desktop.github.com/">GitHub Desktop</a> (GitHub only)</li>
<lidata-marpit-fragment="2">There are also graphical user interfaces for Git like <ahref="https://www.sublimemerge.com/">Sublime Merge</a>, <ahref="https://www.gitkraken.com/">GitKraken</a>, or <ahref="https://desktop.github.com/">GitHub Desktop</a> (for use with GitHub only)</li>
<lidata-marpit-fragment="3">VS Code also has very useful graphical tools for Git (more about them later!)</li>
* Git is a version control tool originally created by Linus Torvalds in 2005
* Git is a ***version control*** tool originally created by Linus Torvalds in 2005
* Keeps track of code changes
* Can be used to backup code in the cloud
* Enables cooperation with other team members
* Ubiquitous in software development
### Why version control?
* Without version control, only one version of your code exists
* *What happens when you realize you made a mistake and need to roll back changes you've made?*
* You could use manual backups, or a cloud storage service
* *What happens if two people connect to a cloud service and edit the same file?*
* Or maybe not even the same file... *What happens when you and your teammate have made changes to code and you need to combine your work into a single, working version?*
* Version control handles all the problems above, and you can focus on the important part: programming!
* You can even try out some big changes that break your software completely
* If that doesn't work out, just roll back into the last working version!
### Git vs cloud storage
* Git is different from cloud storage services like Dropbox, Google Drive or OneDrive
* Instead of automatic syncing, you deliberately *push to* and *pull from* the cloud
* Cloud services are easier for starters
* Cloud services are easier for beginners
* ...but in projects of more than one person, tracking changes would be a pain
* Git has a steep learning curve
* To ease things, there are some visual tools like **Sourcetree** or **Sublime Merge**
* To use them effectively, you still need to understand how Git works, though
* Git is used via the ***terminal*** and has a steep learning curve
* There are some visual tools like **Sourcetree** or **Sublime Merge**
* To use them effectively, though, *you must still understand how Git works*
* Git *could* be used locally, but its usage is almost always combined with a developer platform — a remote storage service like [GitHub](https://github.com/), [GitLab](https://gitlab.com/) or [BitBucket](https://bitbucket.com/)
* These services can also double as a programming portfolio
* These services can also double as a programming portfolio that can help getting hired into the industry
* Commonly used in both open source and commercial projects
* In Buutti's trainings, GitLab is most commonly used
* In Buutti's trainings, ***GitLab*** is most commonly used
</div>
<divmarkdown='1'>



</div>
</div>
## Setup
* Install Git

* Installing Git:
* Windows/Mac: [git-scm.com](https://git-scm.com)
* Installation instructions are included in the following slides.
* If a setting is not mentioned in the instructions, you can leave it as the default option.
* Linux, (also included in the Windows Git install): ***bash***
* We're using PowerShell, which can be accessed inside VS Code
* In VS Code, open/close terminal by pressing ***CTRL+Ö*** (in the Fin/Swe layout)
* We're using PowerShell, which can be accessed inside [VS Code](https://code.visualstudio.com/docs/languages/powershell) or [Visual Studio](https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022)
* In VS Code, open/close terminal by pressing ***CTRL+Ö*** (in the Fin/Swe layout)
* There are also graphical user interfaces for Git like [GitKraken](https://www.gitkraken.com/), [Sublime Merge](https://www.sublimemerge.com/) or [GitHub Desktop](https://desktop.github.com/) (GitHub only)
* There are also graphical user interfaces for Git like [Sublime Merge](https://www.sublimemerge.com/), [GitKraken](https://www.gitkraken.com/), or [GitHub Desktop](https://desktop.github.com/) (for use with GitHub only)
* VS Code also has very useful graphical tools for Git (more about them later!)
* However, the GUIs make ***a lot*** more sense after you've understood the Git commands that those GUIs still execute under the hood
* There is no free lunch here
## Btw: Config
## Note: Config
* To configure your Git username for every project:
* After installation, you may configure your Git username for every project:
* Use `git config --global user.name "myUserName"`
* and `git config --global user.email "my.email.address@domain.com"`
* If you do not do this, Git will ask to do it anyway at some point