The Ultimate Git And Github Crash Course

The Ultimate Git And Github Crash Course

everything you need to get started

Introduction

Git and GitHub are essential tools you need in your everyday life as long as you type on a keyboard. Like seriously, you can track changes made on your document, store it, share it and even allow others to make contributions to it if necessary.

This article will be a total breakdown of Git and GitHub that even someone with no tech background can easily pick up. So you don't need to spend hours watching any youtube videos or spend money buying an online course, I guarantee you, once you’re done reading this article, you will have become a full-fledged git and GitHub practitioner, so what are we waiting for, let's get started.


what is Git and GitHub

Git

Git is basically like a log book that helps you track changes/events on your work and stores it on your computer.

Github

GitHub is a website where you can store your git log book and depending on how many log books you have stored, that determines how repositories you equally have created.


What is the difference between git and GitHub

Git is a version control software for tracking changes and storing code/documents locally while Github is a website for storing out git repository/git logbook


What are the advantages of using git?

  • Version control: Git allows you to track changes made to your code/document over time, enabling you to easily roll back to previous versions if needed. This means you can experiment with new ideas and not worry about losing your work because everything gets saved.

  • Collaboration: Git is designed to make it easy for multiple people to work on the same codebase simultaneously. With Git, you can work on your own copy of the code and join changes back into the main codebase/document when you're done.

  • Branching and merging: Git allows you to create multiple branches/copy of your code, which enables you to work on different features/topics or fixes in parallel. When you're done, you can merge your changes back into the main branch.

  • Flexibility: Git can be used for any type of project, from small personal projects to large enterprise applications. It works equally well with code, documentation, or any other type of file.

  • Open source: Git is open source, which means it's free to use and can be modified to suit your needs. There's also a large community of users who can help you with any questions or issues you might have.


Getting started with Git and GitHub

Step 1 - download git

go to this website, select your operating system and click on a version to download

Step 2 - setting up git with your username and email

  1. open up your terminal

  2. copy and paste this

git config --global user.name "Your name here"
  1. replace the text within the quotation marks with your username

then,

  1. copy and paste this
git config --global user.email "your_email@example.com"
  1. replace the email within the quotation marks with your email.

NOTE: make sure it's a valid email because we are going to be using the same email to create our GitHub account.

Step 3 - creating a GitHub account

  1. go to the GitHub website here

  1. click on the signup button

  2. type in the same email you used when setting up git on your computer

  3. follow the procedures, if done correctly, you should see this

Step 4 - write/ edit your code/document

I advise that you make use of vs code for both writing and coding because it makes things far much easier when working with git and GitHub moreover, the creators of GitHub also made vs code.

to get started with vs code, here.

  1. once you are done writing your code/chapter

  2. create a new terminal in vs code

  • go to Terminal on the menu bar

  • and click on New Terminal

Step 5 - create a new GitHub repository

go to your GitHub account and create a new repository

  • type in the name for the repository and fill in other details

  • then click on Create repository

    NOTE: be careful when setting the visibility status of your repository whether it be public or private

Step 6 - sending your code/document to your online repository

go to the new repository you just created, you'll see some codes

copy and paste it into your new terminal created in vs code

and with that, you are officially a Git and GitHub practitioner.

welcome to the community👏👏🎉


✨✨EXTRA CONTENT✨✨

Top 10 GIT COMMANDS You Need To Know

  1. git init - it is used to initialize your repository. like bringing out a new logbook to start tracking your code/documents

  2. git clone "url of target repository" - it is used to literally clone any repository from GitHub

  3. git add . - it is used to add every changes on your code/document into your logbook but it isn't yet saved.

  4. git commit -m "type in a message to your future self/teammate" - it is used to save the changes on your logbook with a message attached to it

  5. git push - it is used to send/store your logbook to your GitHub account

  6. git branch - used to list out all the branches/alternate versions of your code/document

  7. git branch "name of your branch" - used to create a new branch in your current GitHub repository

  8. git checkout - used to switch to different branches and also used to revert a file to a previous commit

  9. git merge - used to merge one branch into another

  10. git status - used to see modified files that have yet to be added/staged on your logbook


Conclusion

if you made it to the end of this article, congratulations 🎉🎉

I know it can be quite overwhelming at first and you might still be trying to wrap your head around all this information, but always remember If you don't give up you'll eventually get there.

I'm rooting for you.🥳🥳

and if you still need some help, feel free to dm me on Twitter