From 324543ba94e2d8a7d7d75c44361ade87708ba287 Mon Sep 17 00:00:00 2001 From: borb Date: Mon, 28 Jul 2025 13:05:35 +0300 Subject: [PATCH] finish lecture 0: git setup --- 0-git-setup-slides.html | 95 +++++++++++++++++++++++++++------------- 0-git-setup.md | 67 +++++++++++++++++++++------- imgs/git-basics_0.png | Bin 0 -> 19870 bytes imgs/git-basics_1.png | Bin 0 -> 84770 bytes imgs/git-basics_2.png | Bin 0 -> 25307 bytes imgs/git-basics_3.png | Bin 0 -> 15507 bytes 6 files changed, 115 insertions(+), 47 deletions(-) create mode 100644 imgs/git-basics_0.png create mode 100644 imgs/git-basics_1.png create mode 100644 imgs/git-basics_2.png create mode 100644 imgs/git-basics_3.png diff --git a/0-git-setup-slides.html b/0-git-setup-slides.html index 22f9d27..ad7020a 100644 --- a/0-git-setup-slides.html +++ b/0-git-setup-slides.html @@ -13,10 +13,10 @@ /* buutti.css */ /* @theme buutti */div#\:\$p>svg>foreignObject>section .columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns12{display:grid;grid-template-columns:1fr 2fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns21{display:grid;grid-template-columns:2fr 1fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns32{display:grid;grid-template-columns:3fr 2fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns23{display:grid;grid-template-columns:2fr 3fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns111{display:grid;grid-template-columns:1fr 1fr 1fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .centered{display:flex;flex-direction:column;justify-content:center;text-align:center}div#\:\$p>svg>foreignObject>section .tableborderless td,div#\:\$p>svg>foreignObject>section th{border:none!important;border-collapse:collapse}div#\:\$p>svg>foreignObject>section.extra{background-color:#5d275d;background-image:linear-gradient(to bottom,#401a40,#1d0c1d);color:white}div#\:\$p>svg>foreignObject>section.extra a{color:rgb(145,255,209)}div#\:\$p>svg>foreignObject>section.exercise{background-color:#29366f;background-image:linear-gradient(to bottom,#20636a,#173742);color:white}div#\:\$p>svg>foreignObject>section.exercise a{color:rgb(211,173,255)} -/* @theme 6utc5o5vxpmafzrv1zs1wd648slmexwsfa03v7jo4d8d */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure>figcaption{position:absolute;border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}
+/* @theme galct98d0vpgve8tgk1a5752eek9u59mh4p0acv49fg */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure>figcaption{position:absolute;border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}

Project management 0. Git setup

-
+

Contents

-
+

What is Git?

    -
  • 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 +
  • Git is used via the terminal and 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
    • +
    • There are some visual tools like Sourcetree or Sublime Merge
    • +
    • To use them effectively, though, you must still understand how Git works
-
-

GitHub and other developer platforms

+
+

Remote storage services

+
+
  • Git could be used locally, but its usage is almost always combined with a developer platform — a remote storage service like GitHub, GitLab or BitBucket
      -
    • 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
+
+
+

+

+

+
+
-
+

Setup

+

    -
  • Install Git +
  • Installing Git:
-
+

Git setup: Settings for Windows

@@ -93,17 +125,17 @@

-

Set manually after setup with:

+

To set manually after setup, use:

git config --global core.editor "code --wait"
 
-
+

-

Set manually after setup with:

+

To set manually after setup, use:

git config --global init.defaultBranch main
 
@@ -112,7 +144,7 @@
-
+

@@ -122,11 +154,11 @@
-
+

-

Set manually after setup with:

+

To set manually after setup, use:

git config --global credential.helper wincred
 
@@ -135,7 +167,7 @@
-
+

Command line

  • Git is operated via the command line, a.k.a, the terminal
  • @@ -145,11 +177,14 @@
  • Linux, (also included in the Windows Git install): bash
-
  • We're using PowerShell, which can be accessed inside VS Code
  • +
  • We're using PowerShell, which can be accessed inside VS Code or Visual Studio +
    • In VS Code, open/close terminal by pressing CTRL+Ö (in the Fin/Swe layout)
    +
  • +
    -
    +

    Basic commands and the working directory

    • To do actions in Git, you don't press buttons, you write commands
    • @@ -171,13 +206,13 @@
    • Note: .. is a shorthand for to the parent directory, . for the current directory
    -
    +

    Extra: Help, this is horrible!

    • Do you feel more at home in graphical UIs?
    • @@ -188,10 +223,10 @@
    -
    -

    Btw: Config

    +
    +

    Note: Config