Let us understand Git & GitHub

beginner friendly blog!

What does Git and GitHub even mean?
How do they work?
Git is a software to track and make changes in your code but only in your device by you.
Whereas, GitHub let's anybody from anywhere ,make and track your code. couldn't get it?
note: even if anybody make changes it will not effect your code. however, you can "commit" if you wanted to follow the change. Now what is commit? It is what the says, "commit". If you wanted to commit to the change made, you write a commit message and commit. Now that we know what Git and GitHub does. Let us move a step ahead.

There are various ways to push our code to GitHub, We will see couple of them.

Pushing code using command prompt

Firstly, create a new repository in GitHub.com
once we have the repository.
open your command prompt
You can navigate to the file you have your code using cd

cd file

initialize git using code below, your first command is

git init

add your code

git add .

Now next is the commit command or commit messages. Whatever changes you are pushing to github you can mention them in quotes.

git commit -m  "commit message"

you will have a URL for your repository copy it and use this command

git remote add origin <remote repository URL>

intially branch

git branch -M main

push to master

git push  -u origin master

using GitHub desktop

using GitHub desktop is easy peacy comparitively

By clicking on create new repository give it a repository name and create repository.
Once it is done you would have option to open in visual studio code.
Code it
push the code , and commit the code writing the commit messge

"intial message"

You have option to push to GitHub.
Check your repository now, You will have files pushed into the repository

And I'ts done you can follow which ever way easy to you....
Thanks for reading!
Happy learning!