Let's flex the CODE !

Let's flex the CODE !

Learn git and GitHub

ยท

2 min read

Table of contents

No heading

No headings in the article.

Hi Everyone! Welcome back

Do you write code, but it is stored on the hard disk ๐Ÿค” ? You need to flex ๐Ÿ’ช your code to the world. In this article, we will learn how to showcase the code with the help of git and GitHub.

git is the Version Control System which takes snapshots of the project at different versions whereas GitHub is a cloud-based platform that allows you to store git repositories and share them with the world.

Here, is a step-by-step guide to creating a git repo and then posting it on GitHub via git commands.

To install git click here

If you are setting git for the first time, need to add below configuration commands

  • Configuring username mentioned on GitHub
    git  config --global user.name <username>
    

1.png

  • Configuring email using which account is created on GitHub
    git  config --global user.email <email>
    

2.png

  • Initializing git repo. Locate the path where the project is stored in the system on the terminal.
git init

3.png

  • To check the status of files and folders
    git status
    

4.png

  • Add files/folders in the staging area.
git add <file_name>

To add all files and folders

git add.

5.png

  • To change the branch
    git branch -M main
    

6.png

  • To commit (save) all the files/folders
git commit -m <commit message>
git commit -m 'file added'

8.png

GitHub

  • Create a new repository on GitHub

1.PNG

2.png

  • Now, we need to connect our git repo with GitHub. For each repository, we can a unique URL using which we can connect our git repo with GitHub.

3.PNG

  • We will add a remote named origin to connect the
git remote add origin <GitHub repository URL>

7.png it repo and GitHub

  • We will push all the local git repo files to GitHub
git push -u origin <branch name>
git push -u origin main

4.PNG

  • To check git logs
git log

10.jpeg

These commands will help you in flexing your code!

Happy Learning ! ๐Ÿ‘ฉ

Follow for more.

Do share.

Linkedin

Did you find this article valuable?

Support akshita garg by becoming a sponsor. Any amount is appreciated!

ย