Mastering Git and GitHub CLI

A Beginner's Cheat Sheet for Efficient Version Control

📍Introduction

Hey there!

Have you heard of GitHub? It's a version control system that is super popular among developers. If you're interested in collaborating on open-source projects, then knowing how to use GitHub is a must-have skill!

Whether you're a web developer, mobile developer, or cloud enthusiast, having a strong understanding of GitHub CLI can be incredibly helpful in your career. So why not work on building a solid GitHub profile and start learning how to use GitHub CLI today? It could be the boost you need to take your career to the next level!

📍Understanding GitHub and Git

GitHub and Git are essential tools for developers to manage and maintain their codebase. Git is a version control system that helps developers to keep track of changes made to their code locally and remotely. GitHub, on the other hand, is a web-based platform that allows developers to collaborate on open-source projects and share code with others.

While GitHub has an easy-to-use UI, mastering Git requires some learning curve. However, once you learn Git, it can take your career to new heights. Git provides a powerful way to handle the GitHub repository and source code faster and in a reliable manner. Therefore, having a good understanding of Git and a strong GitHub profile can be incredibly beneficial for developers, regardless of their specialty, be it web development, mobile development, or cloud computing 🚀

📍What's Git & Github?

Git: Git is a free and open-source version control system, originally created by Linus Torvalds in 2005. Git is widely used by developers all around the world to manage large and small-scale projects. Since it is an open-source project it is free to use. It helps us to keep track of every modification in our project. Git has been used by various organizations, businesses, professionals, and even startups to manage their code, task allocation, and project management.

Github: GitHub is one of the most advanced development platforms in the world. It has several useful features that enable development teams to work together on the same project and easily create new versions of software without disrupting the current versions. Github is just a cloud-based hosting service that let you manage Git. There are many applications like Github like GitLab or BitBucket.

Git vs GitHub

Screenshot 2022-03-18 at 11.19.50 PM.png

📍Prerequisites for Practicing Git Commands

1. Basic knowledge of the command-line interface (CLI)

The command-line interface (CLI) is a powerful tool used for interacting with the computer's operating system. Git is primarily used via the command line, so having a basic understanding of how to navigate and use the command line is essential.

2. Setting up a Git environment

To practice Git commands, you'll need to have a Git environment set up on your computer. This involves installing Git and setting up a Git repository. There are many online resources available to help you install Git, including step-by-step guides for different operating systems.

You can install Git CLI on your laptop and practice the below cheat sheet command.

https://git-scm.com/downloads

3. Basic knowledge of GitHub

While Git is used primarily via the command line, GitHub is a web-based platform that can be used to manage and collaborate on Git repositories. Having a basic understanding of GitHub, including how to create a repository and push changes to it, can be helpful when practising Git commands.

📍Git Commands Cheatsheets 📄

Let us Begin the Cheatsheet commands with easy to difficult sections. You can follow up the table for commands with an explanation of the commands along them.

CommandDescription
git initInitializes the repository
git clone [url]Clones a repository to your local machine
git add [file]Adds a file to the staging area
git add .Adds all files to the staging area
git commit -m "message"Commits the changes with a message describing the changes
git pushPushes the committed changes to the remote repository
git pullPulls in changes from the remote repository
git statusShows the status of the local repository
git branchLists all branches in the repository
git branch [branch]Creates a new branch off the current branch
git checkout [branch]Switches to the specified branch
git merge [branch]Merges the specified branch into the current branch
git remote -vLists all remote repositories
git remote add [name] [url]Adds a new remote repository with the specified name and URL

These are some of the common GitHub commands that every beginner should know. Use this cheat sheet to help you get started with GitHub and version control in general.

📍Conclusion 🤔

In conclusion, mastering Git and GitHub CLI can be a valuable asset for developers in any field. Whether you're a beginner or an experienced developer, having a good understanding of Git commands can help you manage your codebase more efficiently and collaborate with others more effectively.

The cheat sheet provided above covers some of the most commonly used Git commands that can be used as a quick reference guide while working on your GitHub projects. With consistent practice, you'll soon be able to make the most out of these powerful tools and take your career to new heights.

I will be making another blog post for advanced Git and GitHub concepts & commands which will be helpful to master the version control system. It also helps to understand in-depth Git and GitHub. Stay tuned for it!!!

If you're interested in learning about GitHub and open source, I highly recommend checking out my blog post on Introduction to Open Source with GitHub. I cover everything from the basics of GitHub to collaborating on open-source projects. It's the perfect beginner's guide to get you started on your open-source journey!

Happy coding!