GitHub

Annotated guide to a project page on GitHub. Source: The Turing Way 2021.
Annotated guide to a project page on GitHub. Source: The Turing Way 2021.

GitHub is a hosting platform for managing source code. GitHub offers source code management with version control and collaboration features. With GitHub, developers have a platform to work together on projects from anywhere.

GitHub is widely used to host and manage open source projects. There's also a licensed version of GitHub named GitHub Enterprise, which allows organizations to install and manage GitHub servers in a data centre or on enterprise cloud. Irrespective of GitHub's freely available hosted version or the enterprise licensed version, its main purpose is to:

  • Facilitate version control of source code
  • Track aspects of software development
  • Collaborate using features such as Wikis, project boards, forking, pull requests and merging
  • Provide uniformity in the developers' interaction with the platform

Discussion

  • What are the key terms a developer should know to understand GitHub?
    Important Git and GitHub commands or operations. Source: Adapted from Sahoo 2019.
    Important Git and GitHub commands or operations. Source: Adapted from Sahoo 2019.

    We note a few terms:

    • Repository: A place for source code and other files of a project.
    • Clone: Download a copy of a repository into a local machine to work on it independently.
    • Fork: Copy another's repository into one's own GitHub account. Users usually can't directly update repositories owned by others but can they make changes to the fork.
    • Branch: Isolates code changes. A repository can have multiple branches, each serving a specific purpose, such as a bug fix, feature development or experimentation. Each branch doesn't affect the work on other branches.
    • Pull Request: Describe the changes and request for a review. Applicable to branches and forks. However, they can be also be used to initiate feature discussions.
    • Merge: Take finished work from one branch into a target branch.
    • Fetch: Bring changes from a remote repository to the local copy but keep the local copy untouched.
    • Pull: A combination of fetch followed by merge.
  • What are the key features of GitHub?
    Key features of GitHub. Source: Jones 2018.
    Key features of GitHub. Source: Jones 2018.

    Key features of GitHub include but are not limited to:

    • Distributed revision control, meaning that a clone is a complete copy and allows developers to work offline.
    • Collaboration features such as issues management, project boards, wikis, and adding reviewers to the changes being made in the repository.
    • Automation features such as auto labeling of issues, continuous integration, continuous deployment, and change approval based on events.
    • Team management features such as creating individual accounts, assigning individuals a custom role with defined permissions, inviting other members to collaborate on a repository, creating and assigning email notifications rules, and even imposing restrictions when so required.
    • Ability to check for code vulnerability in real time before it gets shipped to production
    • Other security features such as private repositories, two-factor authentication for user accounts, and security audit logs to track who has performed what actions and when.
  • How is GitHub different from Git?
    Comparing Git versus GitHub. Source: Adapted from McKenzie 2018.
    Comparing Git versus GitHub. Source: Adapted from McKenzie 2018.

    Git is a version control software whereas GitHub is a platform that enables multiple developers to collaborate on a project.

    Git is installed on the user's machine or a server. Typically, a developer installs Git client tools and starts working on the project. When changes are ready to be shared with others, the developer can push them to a shared online repository. GitHub is one such platform for sharing and collaboration. It's a web-based service that hosts Git repositories.

    While Git is focused on version control, GitHub uses Git but also offers many features not native to Git: forking, online editing, branch protection rules, user and team management, encryption key management, email notifications, task tracking, project wikis, marketplace for third-party tools, and more.

    Git has its alternatives: Mercurial, Team Foundation Version Control (TFVC), Bazaar, CVS, SVN, Fossil, Perforce (Helix Core), and more. GitHub too has its alternatives. Amazon CodeCommit, Atlassian BitBucket and GitLab are some examples. Organizations can also create and maintain their own online platforms instead of using GitHub. This is called self-hosting.

  • What are the high-level steps involved in getting started with GitHub?
    Creating a new repository on GitHub. Source: GitHub 2021.
    Creating a new repository on GitHub. Source: GitHub 2021.

    To get started with GitHub, a developer should have internet access to interact with the hosting platform. The developer can begin with these basic steps:

    • Create a GitHub account
    • Create a repository or fork an existing repository
    • When creating a repository, control access using the visibility feature
    • Clone the repository, thereby making a local copy
    • Create a new branch
    • Add a new file: this can be any file, even a text file would do as a start
    • Commit and push the changes from local repository to remote repository on GitHub
    • Create a pull request, applicable when your GitHub repository is a fork another upstream repository
    • When others submit a pull request to your repository, review the pull request and merge it
    • Invite collaborators to contribute to the repository.
  • What tools do I need to interact with GitHub?

    A developer can use the following tools:

    • Web Browsers: GitHub platform is supported by the latest browser versions of Chrome, Firefox, Safari and Microsoft Edge.
    • GitHub CLI: A command-line tool, when installed in the user's system shall be used to interact with various features of the GitHub platform. Using GitHub CLI, a developer can create pull requests, manage bugs, and perform GitHub Actions.
    • GitHub Desktop: This is a GUI-based tool that simplifies the interaction with Git and performs actions related to GitHub branches, fetching or pulling changes into the local repository, committing the changes, and pushing the changes to the remote repository on GitHub.
    • GitHub Mobile: It's a mobile app compatible with Android and iOS devices, using which the users can manage notifications, collaborate on pull requests and issues, and interact with repositories in GitHub. GitHub Mobile app is currently in beta version and applicable for the GitHub Enterprise Server 3.0+ licensed versions.
  • How can I maintain my project source code in the GitHub repository?

    If the project involves only text files for version control, one can create and manage the files in the GitHub's user interface using the compatible browsers as a client-side tool. However, it's best to clone the repository to the local machine when the project involves a complex ecosystem such as a Java, Python or JavaScript-based web development. Cloning is also the solution when you want to group multiple file changes into a single commit.

    As a prerequisite to perform cloning and working on the repository, you should have a GIT client tool (GIT CLI or GitHub Desktop) installed in the system. To clone, you can do either of these:

    • GitHub CLI: gh repo clone <userName>/<repoName>
    • Git Bash: git clone https://github.com/<userName>/<repoName>

    Create a feature branch in the local repository and start adding the files to the project. Once the changes are done, commit them. Then push the changes to the remote GitHub Repository.

  • What are the best practices when using GitHub?

    One of the best practices is to have a README file at the root path of the repository. This should capture high-level project information. While creating the repository, the repository owner can choose a suitable license.

    Write descriptive commit messages. Don't commit directly to the main branch. Instead use branch and create pull requests. Main branch should always be deployable. Commit with the right email address. Don't commit project dependencies or temporary build or log files. Don't commit configurations since these may hold passwords and other secrets. Many of these can be avoided by writing your .gitignore file correctly.

    Don't put passwords, API keys, SSH keys and other secrets in code. Secure your account with two-factor authentication (2FA). Use SSH keys and SSH Git URL, which are essential for 2FA.

    Lock package versions for all project dependencies. Use GitHub's Code Owners feature for faster reviews. This automatically selects reviewers. Another useful feature is GitHub Organizations for easier access control.

    GitHub has published a number of videos that share best practices in many areas: CI/CD, workflow strategies, managing projects, quality control, searching, getting insights, etc.

  • How can I contribute to open source projects in GitHub?
    Search for repositories on GitHub. Source: GitHub 2021.
    Search for repositories on GitHub. Source: GitHub 2021.

    GitHub has a search feature allowing developers to look for suitable projects. Once you've selected a project, fork the repository. This allows you to carry out the changes without impacting the original repository.

    Read and understand the project guidelines to ensure your contributions will meet the criteria defined. As an example, see the guidelines from the Apache Kafka project.

    Once the changes are made in the forked repository, create a pull request to the original project repository. Wait for the review comments from the original repository's collaborators. Address the review comments, if received any, and push the changes. Review gets done and your changes get merged to the original project repository.

    Apart from feature development or fixing issues, there are other ways to contribute. These include documenting Wiki pages, providing clarification to issues reported by others, providing examples in the existing documentation, or enhancing the project's Readme file.

Milestones

Oct
2007

The first code commit is done towards the development of the GitHub hosting platform.

Apr
2008

GitHub's website is made available by Tom Preston-Werner, Chris Wanstrath, P. J. Hyett, and Scott Chacon.

Jul
2010

GitHub reaches a milestone of hosting one million repositories on its hosting platform.

Apr
2013
Evolution of GitHub logo. Source: 1000logos 2021.
Evolution of GitHub logo. Source: 1000logos 2021.

GitHub adopts a new logo along with a mascot named Octocat. Name in the logo capitalizes "G" and "H". GitHub reaches a milestone of 3.5 million users. There are a total of 6 million repositories hosted on GitHub.

Oct
2018

Microsoft acquires GitHub on October 26, 2018.

Apr
2020

GitHub announces the creation and usage terms of private repositories. This is free with no limit on the number of collaborators. Also, users are now allowed to use all the core features of GitHub free of cost.

References

  1. 1000logos. 2021. "GitHub Logo." 1000logos, November 23. Accessed 2022-01-04.
  2. Apache Kafka. 2021. "Apache Kafka." Apache Kafka, on GitHub, December 22. Accessed 2021-12-22.
  3. Awesome GitHub Alternatives. 2021. "Awesome GitHub Alternatives." ianchanning/awesome-github-alternatives, on GitHub, November 27. Accessed 2022-01-04.
  4. Beer, Brent. 2018. "Introducing GitHub." Second Edition, January. O’Reilly Media, Inc. Accessed 2021-12-21.
  5. Catone, Josh. 2008. "GitHub Gist is Pastie on Steroids." Sitepoint, July 24. Accessed 2021-12-21.
  6. Chambers, Dakota. 2018. "Git vs. The Competition." Blog, April 17. Accessed 2022-01-04.
  7. Costello, Jason. 2013. "New GitHub Logo." Blog, GitHub, April 16. Accessed 2022-01-04.
  8. Friedman, Nat. 2020. "GitHub is now free for teams." The GitHub Blog, April 14. Accessed 2021-12-21.
  9. Git. 2021. "GUI Clients." Git. Accessed 2021-12-25.
  10. GitHub. 2017. "GitHub best practices." Resources, GitHub, September 22. Accessed 2022-01-04.
  11. GitHub. 2021. "GitHub Features." GitHub. Accessed 2021-12-25.
  12. GitHub CLI. 2022. "gh repo clone." Manual, GitHub CLI. Accessed 2022-01-05.
  13. GitHub Desktop. 2021. "Download GitHub Desktop." GitHub Desktop. Accessed 2021-12-22.
  14. GitHub Docs. 2021a. "Supported browsers." GitHub Docs. Accessed 2021-12-21.
  15. GitHub Docs. 2021b. "GitHub Mobile." GitHub Docs. Accessed 2021-12-21.
  16. GitHub Docs. 2021c. "Creating a branch." GitHub Docs. Accessed 2021-12-21.
  17. GitHub Docs. 2021d. "About repository." GitHub Docs. Accessed 2021-12-21.
  18. GitHub Docs. 2021e. "Inviting collaborators to a personal repository." GitHub Docs. Accessed 2021-12-22.
  19. GitHub Docs. 2021f. "Fork a repo." GitHub Docs. Accessed 2021-12-22.
  20. GitHub Docs. 2021g. "Example: Contribute to an existing repository." GitHub Docs. Accessed 2021-12-22.
  21. GitHub Docs. 2021h. "About READMEs." GitHub Docs. Accessed 2021-12-22.
  22. GitHub Docs. 2021i. "Cloning a repository." GitHub Docs. Accessed 2021-12-25.
  23. GitHub Docs. 2021j. "About pull requests." GitHub Docs. Accessed 2021-12-25.
  24. GitHub Docs. 2021k. "About branches." GitHub Docs. Accessed 2021-12-28.
  25. GitHub Docs. 2021l. "Merging a pull request." GitHub Docs. Accessed 2021-12-28.
  26. GitHub Docs. 2021m. "GitHub glossary." GitHub Docs. Accessed 2021-12-28.
  27. GitKraken. 2021. "Git Pull vs Fetch." GitKraken, Problems & Solutions, May 28. Accessed 2022-01-04.
  28. Holman, Zach. 2010. "One Million Repositories." The GitHub Blog, July 25. Accessed 2021-12-21.
  29. Holman, Zach. 2011. "Introducing GitHub Enterprise." The GitHub Blog, November 1. Accessed 2021-12-21.
  30. Jones, Jamie. 2018. "Getting Going and Best Practices Guide." GitHub Gist, May 3. Accessed 2022-01-04.
  31. McKenzie, Cameron. 2018. "Git vs. GitHub: What is the difference between them?" TheServerSide, TechTarget, November 6. Accessed 2022-01-04.
  32. NC State University. 2022. "GitHub Best Practices." GitHub at NC State, NC State University. Accessed 2022-01-04.
  33. Preston-Werner, Tom. 2008. "GitHub Turns One!" The GitHub Blog, October 19. Accessed 2021-12-21.
  34. Sahoo, Sunil Kumar. 2019. "How to Update a Fork in Git." Blog, on Medium, December 2. Accessed 2022-01-04.
  35. The Turing Way. 2021. "Using more GitHub features." The Turing Way, December 16. Accessed 2022-01-04.
  36. Warren, Tom. 2018. "Microsoft completes GitHub acquisition." The Verge, October 2018. Accessed 2021-12-21.
  37. Wauters, Robin. 2013. "Github turns five and hits 3.5 million users, 6 million repositories." The Next Web, April 2013. Accessed 2021-12-21.
  38. Zilberman, Eyar. 2018. "Top 10 GitHub best practices for developers." Datree, on Medium, October 24. Accessed 2022-01-04.

Further Reading

  1. GitHub Docs. 2021. "Get Started." GitHub Docs. Accessed 2021-12-21.
  2. GitHub Docs. 2021. "Getting started with your GitHub account." GitHub Docs. Accessed 2021-12-21.
  3. GitHub Docs. 2021. "Finding ways to contribute to open source on GitHub." GitHub Docs. Accessed 2021-12-21.

Article Stats

Author-wise Stats for Article Edits

Author
No. of Edits
No. of Chats
DevCoins
22
5
1507
5
6
1262
1633
Words
0
Likes
1671
Hits

Cite As

Devopedia. 2022. "GitHub." Version 27, January 5. Accessed 2022-06-15. https://devopedia.org/github
Contributed by
2 authors


Last updated on
2022-01-05 10:20:05