What is GitHub?

GitHub is a web-based Git repository hosting service owned by Microsoft. It’s built for version control and collaboration, providing a platform for developers to manage Git projects, share code, and collaborate with others.

Key Features of GitHub

  • Repositories: Centralized places where code, documentation, and version history are stored. Each project lives in its own repository (repo).
  • Branches: Create branches for working on features or fixes separately from the main codebase.
  • Pull Requests (PRs): Propose, review, and discuss changes in code. PRs are central to the GitHub workflow.
  • Issues: Track bugs, enhancements, and tasks within a repository.
  • Actions: GitHub’s CI/CD tool for automating workflows, such as running tests, building projects, or deploying applications.
  • GitHub Pages: Host websites directly from a repository.
  • Forking: Create a personal copy of someone else’s repository to make changes independently.

Basic GitHub Workflow

  1. Fork: Make a copy of the repository to your GitHub account.
  2. Clone: Download the repository to your local machine with git clone [URL].
  3. Create a Branch: git checkout -b [branch-name] to work on a new feature or fix.
  4. Commit Changes: Make edits, then git add . and git commit -m "description".
  5. Push Changes: Send your commits to GitHub with git push origin [branch-name].
  6. Create a Pull Request: Go to the GitHub repository and open a pull request (PR) from your branch to the main branch.
  7. Review & Merge: After approval, merge your PR to the main branch.

Check out the GitHub Cheat Sheet