GitHub Explained: How to Use the Popular Code Platform

GitHub Explained: How to Use the Popular Code Platform

What is GitHub ?

GitHub is like an online storage box for your code.

Imagine you are writing a book and instead of keeping it in your computer, you store it on a special online place where you and your friends can read it and work on it together sitting anywhere in the world. This is exactly what GitHub is.

You can put all of your code on GitHub and store it there. On GitHub you and your friends can work on the codebase together from anywhere in the world. On GitHub you can Save changes, Track your progress, Collaborate with others and Share your code. GitHub is a version control system that helps you manage different versions of your files using git.

GitHub is a platform for your Open-Source projects where you and anybody from anywhere can contribute to it.

Git: The foundation

Git is a tool that track the changes in your code in your computer files. You can make different versions of your files, compare the changes, revert to previous versions and collaborate with others.

Git is the foundation for GitHub. GitHub takes git and provide a user-friendly interface on top of it.

How to use GitHub ?

  1. Install Git in your computer as it is required for GitHub.

  2. Set up git configuration.

     git config --global user.name "Your Name"
     git config --global user.email "your_email@example.com"
    
  3. Create a GitHub account on the website

  4. Create a repository on GitHub where you want to store the code.(You can create Public or Private repository)

  5. Clone that repository using the command

     git clone https://github.com/your-username/your-repository-name.git
    
  6. Make changes and commit

     git commit -m "Your commit message"
    
  7. Push the changes to GitHub

     git push origin main
    

    Replace main with the name of your branch.

Basic GitHub Workflow

  • Create a branch:git branch new-feature

  • Switch to the branch:git checkout new-feature

  • Make changes: Edit files.

  • Commit changes:git add . and git commit -m "Add new feature"

  • Push changes:git push origin new-feature

  • Create a pull request: Propose your changes to the main branch.

In the upcoming posts, we will deep dive into the GitHub commands and their significance. Thanks for reading.