DEV Community

Cover image for GIT and GITHUB Tutorial
OLUWAPELUMI
OLUWAPELUMI

Posted on

GIT and GITHUB Tutorial

Hello!πŸ‘‹

I hope you had a great weekend and successfully tackled the challenge you set for yourself. Moving on, I'd like to build on our previous discussion about Git and GitHub. As a quick recap, I provided an analogy to explain the basics of Git and GitHub, and outlined the key concepts I've learned so far, including:

Image description

Introduction to Git

Git is a version control system that allows developers to track changes made to their code, collaborate with others, and manage different versions of their project. It's a distributed system, meaning that every developer working on a project has a local copy of the entire project history, which makes it easy to collaborate and work on different features or fixes independently.

What is Git?

Git is a free and open-source version control system created by Linus Torvalds in 2005. It's designed to be fast, efficient, and flexible, making it a popular choice among developers. Git allows you to:

  • Track changes made to your code
  • Collaborate with others on the same project
  • Manage different versions of your project (branches)
  • Experiment with new ideas without affecting the main project (branches)
  • Roll back changes if something goes wrong (commits)

Git is an essential tool for developers, and understanding how it works is crucial for any software development project.

What is GitHub?

GitHub is a cloud-based platform that allows developers to store, manage, and share their code with others. It's built on top of Git, using the same version control system, but adds a layer of features and tools to facilitate collaboration, project management, and community engagement.

Relationship to Git

Git is the version control system that tracks changes to your code, while GitHub is a platform that hosts your Git repositories (repos) and provides additional features to manage and share your code. You can think of Git as the engine and GitHub as the car that runs on that engine.

Image description

GitHub Features

  1. Repos (Repositories): A place to store and manage your code. You can create public or private repos, and invite others to collaborate.
  2. Issues: A tool for tracking bugs, feature requests, or tasks. You can assign issues to team members, add labels, and track progress.
  3. Pull Requests: A way to propose changes to a repo. You can create a pull request to merge your changes into the main branch, and others can review and comment on your code.
  4. Code Review: A feature that allows others to review your code, provide feedback, and approve or reject changes.
  5. Collaboration Tools: Features like @mentions, notifications, and project management tools help teams work together efficiently.

Additional features include:

  • Branching: Create separate branches for new features or experiments, and merge them into the main branch when ready.
  • Forking: Create a copy of someone else's repo, and modify it independently.

Image description

Installing Git

  1. Go to the official Git website (https://git-scm.com/download/win) and download the appropriate version for your operating system (Windows, macOS, or Linux).
  2. Follow the installation instructions to install Git on your computer.
  3. Once installed, open a terminal or command prompt and type git --version to verify that Git is installed correctly.

NOTE the command prompt to verify is
git --version
git version 2.30.2.windows.1

git config --global user.name "example.com"
git config --global user.email "example@email.com

Creating a GitHub Account

  1. Go to the GitHub website ((link unavailable)) and click on "Sign up" in the top right corner.
  2. Choose a plan (free or paid) and enter your email address, password, and username.
  3. Verify your email address by clicking on the link sent to you by GitHub.
  4. Fill out your profile information and add a profile picture (optional).

Image description

I'm ready to move on to the next step, although I find it a bit challenging. But as the saying goes, 'practice makes perfect,' so let's proceed to the next oneπŸ˜πŸ‘

Linking Local Git Repositories to GitHub

  1. Create a new local repository by opening a terminal or command prompt and navigating to the directory where you want to initialize the repository.
  2. Type git init to initialize the repository.
  3. Create a new file or add existing files to the repository using git add or git add . (dot) to add all files.
  4. Commit the changes using git commit -m "Initial commit" (including a meaningful commit message).
  5. Create a new repository on GitHub by clicking on the "+" button in the top right corner of your dashboard.
  6. Name your repository and add a description (optional).
  7. Copy the repository URL (HTTPS or SSH) from the GitHub repository page.
  8. In your local repository, type git remote add origin to link the local repository to GitHub.
  9. Push your local changes to GitHub using git push -u origin master (assuming your local branch is named "master").

Let's continue exploring Git and GitHub, and feel free to share your insights or questions to help me learn more.

Image description

Top comments (0)