Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 3.23 KB

File metadata and controls

59 lines (40 loc) · 3.23 KB

Introduction to GitHub and Version Control

What is Version Control?

Version control is a system that records changes to files over time, so you can easily track and manage different versions of your project. Imagine you're working on a long-term coding project or writing a big essay, and you want to test new ideas without messing up your current work. With version control, you can:

  • Revert to previous versions of your files if something goes wrong.
  • Collaborate with others on the same project without overwriting each other's work.
  • Track your progress and see exactly what has changed over time.

Git is the most popular version control system used today, and GitHub is a platform that hosts Git repositories (repos), allowing you to store and share your code or projects online.


Why GitHub?

GitHub is a cloud-based platform for managing Git repositories, making it easier to:

  • Collaborate: Work with others on a project, no matter where they are.
  • Share: Publish your projects, get feedback, and show your work to the world (like potential employers).
  • Manage versions: Keep track of all the changes you and your team make to a project.
  • Open source: Contribute to other people's public projects or allow others to contribute to yours.

Key Concepts in GitHub

1. Repository (Repo)

  • A repository is a project folder on GitHub where all your files live. It also stores the history of every change made to those files.
  • You can create different repositories for different projects, and they can be either public (everyone can see them) or private (only you or people you invite can see them).

2. Commit

  • A commit is like a checkpoint. Every time you make significant changes to your project, you create a commit with a message explaining what you changed.
  • Think of it as saving a version of your project.

3. Branch

  • A branch is like a parallel universe for your project. You can make a new branch to try out new features or ideas without affecting the main project (called the main or master branch).
  • Once your work in the branch is ready, you can merge it back into the main project.

4. Pull Request (PR)

  • When you finish making changes in your branch, you can submit a pull request (PR). This is a request to merge your changes into the main project.
  • PRs are reviewed by others (or yourself) before they are merged to ensure everything works correctly.

How GitHub Works

1. Create a Repository

  • Start by creating a repository on GitHub by clicking the green "New" button on your dashboard.
  • Name your repo something relevant, like My_First_App or History_Essay.

2. Make Changes Locally

  • You can clone (download) the repo to your computer and work on your files using your favorite editor (like VSCode, Sublime, etc.).
  • When you make changes, you can track them using Git commands (more on that below).

3. Commit and Push Your Changes

  • After making changes to your project, you’ll commit those changes with a meaningful message (e.g., "Fixed login bug" or "Added introduction to essay").
  • Then, you push those changes to GitHub to keep your online repo up to date.