Git course 2021
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: "Lecture 1: Motivation" tags: Lecture, Birgitte, day 1 description: "Why use version control?" --- Introduction to Git --- Fall 2021 # Lecture 1: Why use version control? <!-- .slide: data-background="#ffffff" --> <!-- Lecture material made by Mirko Myllykoski for the version of the course that was given in fall 2020. Lecture was first given by Mirko Myllykoski in fall 2020. Minor modifications made by Birgitte Brydsö for the fall 2021 version of the course.--> ![](https://www.hpc2n.umu.se/sites/default/files/umu-logo-left-se.png =250x) ![](https://www.hpc2n.umu.se/sites/default/files/hpc2n-logo-text5.png =250x) ![](https://www.hpc2n.umu.se/sites/default/files/images/SNIC_logo_autocrop.png =250x) <small>Slides: https://hackmd.io/@hpc2n-git-2021/L1-motivation#/</small> --- ## What is version control? --- In software engineering, version control (also known as revision control, source control, or source code management) is a class of systems responsible for __managing changes__ to computer programs, documents, large web sites, or other collections of information. --- Wikipedia --- ### Version control systems (VCS) ... systems responsible for **managing changes** ... --- ## Why use version control? --- In an ideal world, things develop linearly: - Every new version is an improvement upon the previous version. <!-- .element: class="fragment" data-fragment-index="1" --> - No need to backtrack. <!-- .element: class="fragment" --> - Everyone knows what everyone else is doing <!-- .element: class="fragment" --> - In the end, things are simply finished. <!-- .element: class="fragment" --> ```graphviz digraph { rankdir=LR Mon[label="Monday's\n improvements"] [fixedsize=circle] Tue[label="Tuesday's\n improvements"] [fixedsize=circle] Wed[label="Wednesday's\n improvements"] [fixedsize=circle] Mon -> Tue Tue -> Wed } ``` <!-- .element: class="fragment" data-fragment-index="1" --> --- In the real world, things develop non-linearly: - A new version can be anything between <!-- .element: class="fragment" data-fragment-index="1" --> - a complete catastrophe and - a major breakthrough. - People do not know what others are doing <!-- .element: class="fragment" data-fragment-index="2" --> - Sometimes we are simply fixing earlier mistakes... <!-- .element: class="fragment" data-fragment-index="3" --> ```graphviz digraph { rankdir=LR Mon[label="Monday's\n improvements"] [fixedsize=circle] Tue[label="Tuesday's\n mistakes"] [fixedsize=circle] Wed[label="Wednesday's\n corrections"] [fixedsize=circle] Mon -> Tue Tue -> Wed } ``` <!-- .element: class="fragment" data-fragment-index="3" --> --- ### Going back to an earlier version Sometimes, it is easier to simply backtrack to an *earlier version*... ```graphviz digraph { rankdir=LR Mon[label="Monday's\n improvements"] [fixedsize=circle] Tue[label="Tuesday's\n mistakes"] [fixedsize=circle] Wed[label="Wednesday's\n improvements"] [fixedsize=circle] Mon -> Tue Mon -> Wed } ``` --- #### Where is this *earlier version*? - CTRL + Z <!-- .element: class="fragment" --> - my_file.txt, my_file.txt.old, ... <!-- .element: class="fragment" --> - My project/ <!-- .element: class="fragment" --> - 2020-08-12/ - 2020-08-13/ - ... - Daily home directory backup <!-- .element: class="fragment" --> --- #### Challenges and obstacles - Prone to mistakes <!-- .element: class="fragment" --> - CTRL + Z has limits, overwritten/deleted files, human/hardware error <!-- .element: class="fragment" --> - How much to save? <!-- .element: class="fragment" --> - Individual files? Everything? How much space is required? <!-- .element: class="fragment" --> - How to organize versions? <!-- .element: class="fragment" --> - What is the difference between different versions? <!-- .element: class="fragment" --> *Overall, difficult to manage!* <!-- .element: class="fragment" --> --- #### What about the granularity? ```graphviz digraph { rankdir=LR subgraph cluster1 { t1a [label="Component A\n improvement"] [fixedsize=circle] t1b [label="Component B\n mistake"] [fixedsize=circle] t1c [label="Component C\n improvement"] [fixedsize=circle] label="Mondays's changes" } subgraph cluster2 { t2a [label="Component A\n improvement"] [fixedsize=circle] t2b [label="Component B\n correction"] [fixedsize=circle] t2c [label="Component C\n mistake"] [fixedsize=circle] label="Tuesday's changes" } subgraph cluster3 { t3a [label="Component A\n mistake"] [fixedsize=circle] t3b [label="Component B\n improvement"] [fixedsize=circle] t3c [label="Component C\n correction"] [fixedsize=circle] label="Wednesday's changes" } t1a -> t2a t1b -> t2b t1c -> t2c t2a -> t3a t2b -> t3b t2c -> t3c } ``` *This compounds the problems!* --- #### How does VCS solve this? - Stores the history using snapshots (commits) <!-- .element: class="fragment" --> - Each snapshot represents the project at a given point in time <!-- .element: class="fragment" --> - Manages snapshots and associated metadata <!-- .element: class="fragment" --> - Naming (tags), comments, dates, authors, etc <!-- .element: class="fragment" --> - Easy to move between different snapshots <!-- .element: class="fragment" --> - Can handle different degrees of granularity <!-- .element: class="fragment" --> - Can handle multiple development paths (branches) <!-- .element: class="fragment" --> --- ### Comparing and joining - VCS makes it easy to compare different snapshots <!-- .element: class="fragment" --> - Named revisions, comments, time information, author information <!-- .element: class="fragment" --> - Diff tools <!-- .element: class="fragment" --> - Search tools <!-- .element: class="fragment" --> - Bisection search <!-- .element: class="fragment" --> - VCS also allows the joining (merging) of different snapshots <!-- .element: class="fragment" --> - Easy to experiment with ideas <!-- .element: class="fragment" --> --- ### Collaboration - One of the primary functions of VCS is to allow collaboration <!-- .element: class="fragment" --> - Usual setup: server (remote) + multiple clients <!-- .element: class="fragment" --> - People work locally and send (push) the changes to the server <!-- .element: class="fragment" --> - VCS keeps track of what has been done and by whom <!-- .element: class="fragment" --> - Safer since mistakes can be easily remedied <!-- .element: class="fragment" --> - The contributions of several people can be merged <!-- .element: class="fragment" --> --- ### Backup - VCS functions as a backup <!-- .element: class="fragment" --> - Locally, the system maintains a copy of each file <!-- .element: class="fragment" --> - Usually only the changes or the files that have changed are stored <!-- .element: class="fragment" --> - Globally, lost files can be recovered from the server <!-- .element: class="fragment" --> --- ### Integration - VCSs such as Git have been integrated with several services <!-- .element: class="fragment" --> - HackMD, Overleaf, ... - Services such as GitHub can do almost everything for you <!-- .element: class="fragment" --> - Store history, distribute, testing / continuous integration, bug reports, milestones, website, ... <!-- .element: class="fragment" --> --- ### Summing up Version control systems - keeps track of your files and other output - tracks what is created and modified - tracks who made the modifications - tracks why the modifications were made (if you make good commit comments) --- ## Practical use cases What are the practical use cases for VCS? --- ### Source code - Many VCSs are designed for managing source code <!-- .element: class="fragment" --> - Manage deployment (production, development, testing, etc) <!-- .element: class="fragment" --> - Manage published versions (v0.1 etc) <!-- .element: class="fragment" --> - Manage (experimental) features <!-- .element: class="fragment" --> - Bug hunting <!-- .element: class="fragment" --> - But also for: writers, artists, composers... <!-- .element: class="fragment" --> --- ### Latex files - Track which version of a manuscript has been <!-- .element: class="fragment" --> - submitted, - revised and/or - accepted - Collaboration between several authors <!-- .element: class="fragment" --> --- ### HPC: batch files and data - Track different version of your batch scripts <!-- .element: class="fragment" --> - Easy to check the used configuration afterwards - Track input and output files <!-- .element: class="fragment" --> - Limited to smallish files --- ### Examples of VCS <!-- .slide: style="font-size: 24px;" --> - SCCS: The first VCS. Created in 1972 at Bell Labs. Was available only for UNIX and worked with Source Code files only. - RCS (Revision Control System): First release July 1985. Usually superseded by other systems such as CVS, which began as a wrapper on top of RCS. - CVS (centralized version control system): First release July 1986; based on RCS. Expands on RCS by adding support for repository-level change tracking, and a client-server model. - Apache Subversion (SVN): First release in 2004 by CVS developers with the goal of replacing CVS. - BitKeeper: Initial release May 2000. Distributed version control. Was shortly used for developing the Linux kernel. Proprietary. No longer maintained. - **Git**: Started by Linus Torvalds in April 2005, originally for developing the Linux kernel. Distributed version control. Open source. - ... ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully