Git, GitHub and Markdown

https://github.com/heig-vd-dai-course

Web · PDF

L. Delafontaine and H. Louis, with the help of GitHub Copilot.

This work is licensed under the CC BY-SA 4.0 license.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Objectives

  • Understand Git, GitHub, and Markdown
  • Develop crucial collaboration skills
  • Emphasize the significance of documentation for code usability and project visibility
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Git

More details for this section in the course material. You can find other resources and alternatives as well.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Git

  • A version control system (VCS)
  • Created in 2005 by Linus Torvalds
  • Efficiently tracks changes in files
  • Used to manage source code and documentation within a project
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Architecture

  • Git operates with a client-server structure:
    • Remote repositories (server)
    • Local repositories (local copies known as clones)
  • Fully distributed VCS for offline work: each clone contains the full history
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Commits, hashes and tags

  • Commits represent snapshots of the repository
  • Each commit has a unique, unalterable hash
  • Tags serve as references, often for releases
  • Commit signing enhances security
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Branches

  • Tracks distinct repository versions
  • Default branch is typically named main
  • Branches have names and commit pointers (heads)
  • Allow to work on features or bug fixes without affecting the main branch
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Merging branches

  • Collaborative project workflow
  • Three primary merging methods:
    • Merge
    • Rebase
    • Squash
  • In this course, you will focus on the merge method
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Conflicts

  • Arise from simultaneous file edits
  • Git detects and requires resolution
  • Conflicts must be resolved to decide which changes to keep
  • It can be tricky but is a crucial skill
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Ignore Files

  • gitignore files omit specific files that should not be on the repository
  • Improves repository cleanliness and security (avoid sensitive data leaks)
  • Tip: avoid online gitignore generators, they generate a lot of unnecessary rules
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Summary

  • Git is a distributed VCS
  • Git uses commits to track changes
  • Git uses branches to track different versions of the repository
  • Git can pull changes from a remote repository
  • Git can merge, rebase or squash branches/commits
  • Git can detect and resolve conflicts

We encourage you to learn how to use Git from the command line, so you can still use it everywhere (even on a server).

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

GitHub

More details for this section in the course material. You can find other resources and alternatives as well.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

GitHub

  • Git hosting platform
  • Created in 2008
  • Web-based Git hosting
  • Popular for open source projets
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Social platform

  • Social interactions:
    • Follow users
    • Star projects
    • Discover new projects
  • Forking repositories
    • Create a copy of a repository
    • Make changes and contribute back
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Free features and PRO features

  • Enhanced features with PRO
    • Access to premium features and software
  • Free for students - you can apply!
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Users and organizations

  • Users or organizations ownership
  • Users can be part of multiple organizations
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Issues, pull requests and forks

  • Contribution workflow
    • Issues
    • Forks
    • Pull requests
  • Approval process
  • Project management tools (wiki, planning, etc.)
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Summary

The whole process would be as follow:

  1. Open an issue to discuss the feature (optional, but recommended)
  2. Clone or fork the project and checkout to a new branch
  3. Make your changes, commit and push them as often as you want
  4. Create the pull request
  5. The maintainers review and merge if OK
  6. You can delete the branch or the fork
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Markdown

More details for this section in the course material. You can find other resources and alternatives as well.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Markdown

  • Lightweight markup language
  • Created by John Gruber and Aaron Swartz in 2004
  • Simple and versatile
  • Used by many platforms and tools
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Markdown and output formats

  • Multiple output formats
  • Supports HTML integration
  • Used in web pages, presentations, documentation
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Syntax

  • Markup language with special characters (#, *, -, [], ! _, etc.)
  • Discord and Telegram uses Markdown for formatting
  • Supports headings, text formatting, code blocks, lists, links, images, and tables
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Specifications

  • No single standard
  • CommonMark and GitHub Flavored Markdown are the most popular
  • Custom extensions for additional features on some platforms
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Summary

  • Markdown is easy to learn and use
  • Markdown can be used to create documentation
  • Markdown can be used to create slides
  • Markdown can be exported to many formats
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Questions

Do you have any questions?

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Practical content

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

What will you do?

  • Install and configure Git
  • Create and configure your GitHub account
  • Create your own GitHub profile README
  • Add yourself to the GitHub organization README
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Find the practical content

You can find the practical content for this chapter on GitHub.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Finished? Was it easy? Was it hard?

Can you let us know what was easy and what was difficult for you during this chapter?

This will help us to improve the course and adapt the content to your needs. If we notice some difficulties, we will come back to you to help you.

➡️ GitHub Discussions

You can use reactions to express your opinion on a comment!

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

What will you do next?

In the next chapter, you will learn the following topics:

  • Java: why is Java a popular programming language?
  • IntelliJ IDEA: tips and tricks for a better (collaborative) experience
  • Maven: Java project structure, dependencies and build tool
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Sources

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0