Hare are some notes about GitHub Foundation. The concepts were extracted from documentation and Udemy training.

  1. Basic
  2. Repositories
  3. Collaboration
  4. Development
  5. Project Management
  6. Privacy, Security, and Administration
  7. Community


Introduction to Git and GitHub

Git and GitHub Basics

  • Open Source:
    • open source software (OSS) refers to software that features freely available source code, which users may view, modify, adopt, and share for both commercial and noncommercial purposes.[1]
  • Version Control:
    • A version control system (VCS) is a program or set of programs that tracks changes to a collection of files facilitating collaboration, and maintaining a history of modifications. Another name for a VCS is a software configuration management (SCM) system. [1]
    • VCS does not aim to ensure compliance with industry regulations as files are created or changed[1]
  • Distributed Version Control:
    • Every developer has a full copy of the project and project history. It means DVCSs don't need a constant connection to a central repository. [1]
    • Git is distributed, which means that a project's complete history is stored both on the client and on the server. [2]
  • Git[1]:
    • Decentralized or distributed version control system. Git is free and open-source. Git's de-facto standard status: wide adoption and integration into other tools.
    • Terminology: Working tree; repository; hash; object (blob, tree, commit, tag); commit; branch; remote; command, subcommand and options
  • GitHub repository:
    • Repository (repo): The directory, located at the top level of a working tree, where Git keeps all the history and metadata for a project. [1]
  • Commit:
    • As a verb, committing changes means you put a copy (of the file, directory, or other "stuff") in the repository as a new version. When the command is invoked, the work is saved to a snapshot. As a noun, a commit is the small chunk of data that gives the changes you committed a unique identity. The data that's saved in a commit includes the author's name and e-mail address, the date, comments about what you did (and why), an optional digital signature, and the unique identifier of the preceding commit. [1]
  • Branching:
    • A branch is a named series of linked commits. The most recent commit on a branch is called the head. The default branch, which is created when you initialize a repository, is called main, often named master in Git. The head of the current branch is named HEAD. [1]
  • GitHub:
    • GitHub is a web-based app that lets you host files in repositories, collaborate on work, and track changes to files over time. Version tracking on GitHub is powered by the open source software Git. Whenever you update a repository on GitHub, Git tracks the changes you make.[1]
    • GitHub hosts Git repositories and provides developers with tools to ship better code through command line features, issues (threaded discussions), pull requests, code review, or the use of a collection of free and for-purchase apps in the GitHub Marketplace.
    • GitHub is a cloud platform that uses Git as its core technology. GitHub acts as the remote repository. [2]
  • Git vs GitHub:
    • The main difference between Git and GitHub is that Git is a distributed version control system that you install and run locally on your computer. It helps you track changes to your code over time. GitHub, on the other hand, is a web-based platform that provides hosting for Git repositories. It adds many collaborative features on top of Git, such as issue tracking, pull requests, and a web interface for managing your code. Think of Git as the engine for version control, and GitHub as a popular online service that uses Git as its engine and provides a social and collaborative environment for developers. [from Gemini]
  • GitHub flow:
    • "GitHub flow": create branch or fork, edit and preview files, commit changes, and create a pull request; besides upload/download files from/to your computer. [1]

CLI

git init demo
git status
git show 09e90cd7
git log --oneline
git help commit
git revert HEAD README.md
git checkout -- README.md
git diff 09e90cd7 HEAD

// Alias:
git log --oneline --graph --decorate --all
git config --global alias.hist "log --oneline --graph --decorate --all"
git config --global --list
git hist -- README.md

// connections
git remote -v

// Set default branch
git config --global init.defaultBranch main

// tag
git tag mytag mybranch
git tag
git tag -a v0.1-beta -m "Release 0.1 (Beta)" 85fe102 
git show v0.1-beta
git push origin mytag
git push --tags

GitHub Entities

Every user has an GH account. Accounts allow you to organize and control access to that code.

  • GitHub accounts (personal, organization, enterprise):
    • User account:
      • Personal account: if you signed up for your own account on GitHub.com, you are using a personal account
      • Managed account: account created by an enterprise on GitHub Enterprise Cloud. You can create your own private repositories
      • Machine users are accounts created to automate an activity
    • Organization account:
      • Organizations are shared accounts where a large number of people can collaborate across many projects at once.
      • Organizations are limited to owning 100,000 repositories.
      • An organization account enhances collaboration between multiple users
    • Enterprise account:
      • Centrally manage policy and billing for multiple organizations and enable innersourcing between the organizations.
      • Allows central management of multiple organizations
  • GitHub’s products for personal accounts (free, pro):
    • All personal accounts can own an unlimited number of public and private repositories, with an unlimited number of collaborators on those repositories.
    • GitHub Free: private repositories owned by your personal account have a limited feature set. You can upgrade to GitHub Pro to get a full feature set for private repositories. [1]
  • GitHub’s products for organization accounts (free for organizations, teams):
    • You can use organizations for free, with GitHub Free, which includes limited features on private repositories.[1]
    • Organization owners can assign roles to individuals and teams giving them different sets of permissions in the organization[1]
    • You can manage a person's access to a repository owned by your organization.[1]
    • You can invite former organization members to rejoin your organization, and choose whether to restore the person's former role, access permissions, forks, and settings[1]
    • Before requiring two-factor authentication (2FA), you can notify users about the upcoming change and verify who already uses 2FA[1]
    • Teams are groups of organization members that reflect your company or group's structure with cascading access permissions and mentions[1]
  • Deployment options for GitHub Enterprise[1]:
    • GH Enterprise Cloud: Hosted by GH
    • GH Enterprise Server: hosted in your own GH instance (on-premises or cloud service)
  • Features in the user profile (metadata, achievements, profile readme, repositories, pinned repositories,stars, etc.):
    • Your profile page tells people the story of your work through the repositories you're interested in, the contributions you've made, and the conversations you've had.[1]
    • You can add a README to your GitHub profile to tell other people about yourself.[1]
    • You can PIN gists and repositories to your profile so other people can quickly see your best work.[1]
    • Organization's profile page shows basic information about your organization.[1]

GitHub Markdown

  • Markdown is a lightweight markup language for formatting text in README files, issues, and comments on GitHub. It provides a simple and readable way to style text and add elements such as headers, lists, links, and images. It's NOT specific to GitHub. [1][2][3][4]

GitHub Desktop

  • GitHub Desktop is a free, open source application that helps you to work with files hosted on GitHub or other Git hosting services.[1]
  • GitHub Desktop vs github.com: GitHub Desktop is a graphical user interface (GUI) for interacting with GitHub, a website where you can host and manage Git repositories. It allows you to perform common Git operations like cloning, committing, pushing, and pulling, but through a visual interface instead of using the command line. Github.com is the website itself, where you can host repositories, create issues, and collaborate with others. [from Gemini]

GitHub Mobile

  • Triage, collaborate, and manage your work on GitHub from your mobile device[1]
  • Features: web-based code editing in PR; read, review, and collaborate on issues and pull requests [1]




Working with GitHub Repositories

  • Best practices[1]:
    • Create a README file for every repository;
    • single repository to streamline collaboration, creating pull requests between branches instead of between repositories.
    • Forking is best suited for accepting contributions from people who are unaffiliated with a project, such as open-source contributors;
    • To track large files in a Git repository, GitHub recommends using Git Large File Storage (Git LFS)
  • Recommended file for a new repo that provide essential information about the project, help contributors understand the codebase, and maintain transparency in the development process: .gititnore, a contributing file to document the guidelines on how people should contribute to your project, a licence that communicates how users can use the files contained in the repository, readme, CODEOWNERS
  • README
    • Goal: why your project is useful, what they can do with your project, how they can use it, Where users can get help, Who maintains and contributes[1]
    • Where to put: .github, root and docs; using that precedence
    • License: public repo needs that to be free to use by others. Without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work [1]
    • Codeowners: You can use a CODEOWNERS file to define individuals or teams that are responsible for code in a repository.[1]
    • Topics: To help other people find and contribute to your project
  • How to
  • Different features to maintaining a repository: Access Control and Permissions, Branch Management, Pull Requests, Issue Tracking, Managing labels and Milestones, Releases, Github Action, Repository Setting, .gitignore file, Code review tools
  • Feature previews
  • You can restrict who has access to a repository by choosing a repository's visibility: public, internal, or private[1][2]
  • We recommend that regular collaborators work from a single repository to streamline collaboration, creating pull requests between branches instead of between repositories. Forking is best suited for accepting contributions from people who are unaffiliated with a project, such as open-source contributors.[1]




Collaboration Features

Issues

  • Issues can be used to plan, discuss, and track work. Issues can track bug reports, new features and ideas, and anything else you need to write down or discuss with your team. You can also break your work down further by adding sub-issues and easily browse the full hierarchy of work to be done. [1]
  • You can classify issues, pull requests, and discussions by creating, editing, applying, and deleting labels. [1]
  • You can create a branch to work on an issue directly from the issue page and get started right away [1]
  • You can configure your project's built-in workflows to automatically archive items that match a filter [1]
  • Projects is an adaptable, flexible tool for planning and tracking work on GitHub. <[1]
  • Best Practices: Break down large issues into smaller issues, communicate, Make use of the description, README, and status updates, use views, Have a single source of truth, use automation, Use different field types, [1]
  • You can assign multiple people to each issue or pull request. A paid account can have up to 10 people assigned. Private repositories on the free plan are limited to one person per issue or pull request. [1]
  • You can link a pull request or branch to an issue to show that a fix is in progress and to automatically close the issue when the pull request or branch is merged. [1]
  • Checking your highest notification priorities:
    • Pull requests where your review is requested: reason:review-requested
    • Events where your username is @mentioned: reason:mention
    • Events where a team you're a member of is @mentioned: reason:team-mention
    • CI workflow failures for a specific repository: reason:ci-activity and repo:owner/repo-name
  • GitHub users with at least read access, including those without write access, can create an issue. GitHub allows any user, regardless of their level of access or affiliation, to create issues on a repository. This inclusivity supports open collaboration and contribution.[1]
  • Discussions are used for general conversations and collaboration, while issues are specific items that need attention, such as bugs or feature requests. [1]
  • issue templates merely provide text that contributors can remove and replace with their own input, but a form enables you to build structured forms with required fields and easy-to-follow steps to ensure you don't miss important details[1]

Pull requests

Discussions

  • GitHub Discussions is a collaborative communication forum for the community around an open source or internal project[1]
  • You can pin a discussion above the list of discussions for the repository or organization or to a specific category. The globally pinned discussions will be shown in addition to the discussions pinned to a specific category.[1]

Notifications

  • Notifications provide updates about the activity on GitHub that you've subscribed to. You can use the notifications inbox to customize, triage, and manage your updates[1]

Gists, Wikis, and GitHub Pages

  • Gists provide a simple way to share code snippets with others. Every gist is a Git repository. If you are signed in to GitHub when you create a gist, the gist will be associated with your account. Gists can be public or secret. you can fork or clone any gist, even if you aren't the original author. You can also view a gist's full commit history, including diffs[1][2]
  • Wikis: Every repository on GitHub comes equipped with a section for hosting documentation, called a wiki.[1]
  • Github Pages: You can use GitHub Pages to showcase some open source projects, host a blog, or even share your résumé [1]
  • To create a new Gist, you should go to the Gist homepage. This is the dedicated space for managing and creating Gists on GitHub.[1]




Modern Development

  • Actions:
    • GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production[1][2]
    • Workflows can be reused[1]
    • Events that trigger workflows: PR, push, open an issue[1][2]
  • Marketplace:
    • GitHub Marketplace connects you to developers who want to extend and improve their GitHub workflows. You can list free and paid tools for developers to use in GitHub Marketplace. GitHub Marketplace offers developers two types of tools: GitHub Actions and Apps, and each tool requires different steps for adding it to GitHub Marketplace.
    • GitHub Marketplace is a central location for finding actions created by the GitHub community. You can search and browse actions directly in your repository's workflow editor. From the sidebar, you can search for a specific action, view featured actions, and browse featured categories. You can also view the number of stars an action has received from the GitHub community.[1] </ul>
    • Copilot:
      • GitHub Copilot is an AI coding assistant that helps you write code faster and with less effort, allowing you to focus more energy on problem solving and collaboration
      • Implementing Copilot Business for users allows the organization to configure the service to meet company-wide policies and exclude specific files from being evaluated. [1]
      • It is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language. Languages with less representation in public repositories may produce fewer or less robust suggestions.[1]
    • Codespace:
      • A codespace is a development environment that's hosted in the cloud. Each codespace you create is hosted by GitHub in a Docker container, running on a virtual machine.
      • You can connect to your codespaces from your browser, from Visual Studio Code, from the JetBrains Gateway application, or by using GitHub CLI. When you connect, you are placed within the Docker container. You have limited access to the outer Linux virtual machine host.
      • Inactive codespaces are automatically deleted. You can choose how long your stopped codespaces are retained, up to a maximum of 30 days. However, because GitHub Codespaces incurs storage charges, you may prefer to reduce the retention period by changing your default period in your personal settings for GitHub Codespaces.[1]
      • You can store sensitive information, (tokens, service principals, credentials), that you want to access in your codespaces via environment variables. You can add development environment secrets to your personal account that you want to use in your codespaces[1]



    Project Management

    • The roadmap layout provides a high-level visualization of your project across a configurable timespan, and allows you to drag items to affect their start and target dates or selected iteration. [1]
    • Projects is designed to integrate with external tools and services. This provides more options to customize the project boards and workflows for issues, pull requests, and much more. [1][2]
    • Projects (classic) on GitHub help you organize and prioritize your work. You can create projects (classic) for specific feature work, comprehensive roadmaps, or even release checklists. With projects (classic), you have the flexibility to create customized workflows that suit your needs. [1][2]
    • Using insights to create chart:
      • current chart: visualize the current status of items assigned to each team member in real-time
      • user chart: displays information related to individual users, such as their activity or contributions, rather than the distribution of assigned items among team members.
      • historical chart: it focuses on visualizing data over a period of time in the past
      • project chart: typically provides an overview of the project's progress, milestones, or tasks, rather than focusing on individual team members' assignments.
    • Information is synced automatically to your project as you make changes, updating your views and charts. When you change information about a pull request or issue in your project, the pull request or issue reflects that information.[1][2]
    • Milestones in GitHub are designed for grouping and tracking related issues, making it efficient for tracking and reporting purposes.[1]
    • You can assign multiple people to each issue or pull request, including yourself, anyone who has commented on the issue or pull request, anyone with write permissions to the repository, and organization members with read permissions to the repository. Anyone with write access to a repository can assign issues and pull requests.
    • GitHub Save Replies allows you to save and reuse responses [1]
    • Labels on GitHub can be used to categorize and filter issues or pull requests based on their characteristics, such as priority, type, status, or any custom criteria. This helps in organizing and prioritizing tasks, making it easier for team members to identify and work on specific items efficiently.[1]
    • You can view your project as a high-density table, as a kanban board, or as a timeline-style roadmap. While changing the layout of a GitHub project, there are Table layout, board layout, or roadmap layout are the only three layouts that GitHub Projects provides.[1]
    • You can either create an organization project or a user project. To create an organization project, you need a GitHub organization[1]



    Privacy, Security, and Administration

    • Administrators must decide how users will access the enterprise's resources on GitHub.
    • You can use SAML single sign-on (SSO) to centrally manage access to organizations owned by your enterprise on GitHub.com.
    • Learn how your enterprise can manage the lifecycle and authentication of users on GitHub from your identity provider (IdP)
    • GitHub's security features help keep your code and secrets secure in repositories and across organizations.
    • With roles, you can control who has access to your accounts and resources and the level of access each person has
    • A repository owned by a personal account has two permission levels: the repository owner and collaborators
    • Within GitHub repositories you can disable: wikis, sponsorship, issues, discussions, actions [1][2][3]
    • GitHub makes extra security features available to customers under an Advanced Security license (GHAS): Code scanning, Secret scanning, Dependency review [1]
    • You can give organization members, outside collaborators, and teams of people different levels of access to repositories owned by an organization by assigning them to roles.[1]
    • GitHub offers security features that help keep data secure in repositories and across organizations. The security tab of a GitHub repository provides information on security policies, dependency alerts, security advisories, and vulnerability scans including details about identified security vulnerabilities in the repository's code. [1]
    • GitHub Enterprise Cloud administrators can allow people to use a personal account on GitHub.com to access your enterprise's resources and optionally configure additional SAML access restriction, or can provision and control enterprise accounts using your identity provider (IdP) with Enterprise Managed Users.[1]
    • You can configure two-factor authentication (2FA) using a TOTP app on mobile or desktop or via text message. After you have configured 2FA using a TOTP app or via text message, you can add security keys as an alternate 2FA method.[1]
    • If you lose access to your two-factor authentication credentials, you can use your recovery codes, or another recovery option, to regain access to your account. Using recovery codes provides the ability to automatically regain entry into your account.[1]
    • Internal visibility for a repository: You can use internal repositories to practice "innersource" within your enterprise. Members of your enterprise can collaborate using open source methodologies without sharing proprietary information publicly. You can only create internal repositories if you use GitHub Enterprise Cloud with an enterprise account. An enterprise account is a separate type of account that allows a central point of management for multiple organizations.[1]
    • Branch protection is used to prevent accidental or unauthorized changes to branches by setting restrictions on who can push or merge changes to the branch. This helps maintain the integrity of the codebase and ensures that only approved changes are made to critical branches. protection rules, which define whether collaborators can delete or force push to the branch and set requirements for any pushes to the branch [1][2]
    • Manage collaborators by repository setting[1]
    • An organization's news feed shows other people's activity on repositories owned by that organization[1]
    • Billing managers can: Upgrade or downgrade the account; Add, update, or remove payment methods; View payment history; Download receipts; View, invite, and remove billing managers; Start, modify, or cancel sponsorships; In addition, all billing managers will receive billing receipts by email on the organization's billing date[1]



    Benefits of the GitHub Community

    • Contribution
    • Issue and pull request templates
    • Community Discussion
    • You can mark a comment in the discussion as an answer to the discussion if a discussion is within a category that accepts answers.
    • Following people
    • Use your inbox to quickly triage and sync your notifications across email and mobile
    • GitHub doesn't enforce legal compliance for open-source projects. it provides features like license templates [2]
    • When you follow organizations on GitHub, you'll see their public activity on your personal dashboard. This activity includes new discussions, sponsorships, and repositories.[1]
    • Open-source software development is based on principles of open communication, collaborative contribution from a diverse community, and the distribution of software that is accessible to everyone. These principles promote transparency and inclusivity[1]
    • To make your pull request template visible in the repository's root directory, name the pull request template pull_request_template.md.[1]
    • A fork is a new repository that shares code and visibility settings with the original upstream code repository. Forks are often used to iterate on ideas or changes before they are proposed back to the upstream repository, such as in open source projects or when a user does not have write access to the upstream repository. Developers can use forks to propose changes related to fixing a bug without impacting the original upstream repository.[1]
    • Issue templates are helpful when you want to provide guidance for opening issues while allowing contributors to specify the content of their issues. If you want contributors to provide specific, structured information when they open issues, issue forms help ensure that you receive your desired information[1]



    References