Git is a free, open-source version control software. It was created by Linus Torvalds in 2005. This tool is a version control system that was initially developed to work with several developers on the Linux kernel. Git can be used to store content — it is mostly used to store code due to the other features it provides.
Real life projects generally have multiple developers working in parallel. So a version control system like Git is needed to ensure there are no code conflicts between the developers. A version control system allows developers to revert and go back to an older version of the code. A branch system in Git allows developers to work individually on a task.
If we want to start using Git, we need to know where to host our repositories.
Repository: a project that contains multiple files. In our case a repository will contain code-base files.
There are two hosting platforms to host our repositories.
Before using Git & GitHub we should know why we need it?
We’ll work with GitHub projects in two ways.
Type 1 is about create a totally fresh repository on GitHub, clone it to our computer, work on our project and push it back.
Type 2 is about make a fresh repository from an existing folder on our computer and send that to GitHub because a lot of cases you might actually have already made something on your computer that you want suddenly turn into a repository on GitHub.
# Pulling is the act of receiving from GitHub. Pushing is the act of sending to GitHub.
Once you have your GitHub account set up, you are ready to install GitHub Desktop. In your browser: Open a new browser tab. Navigate to desktop.github.com Download GitHub Desktop. Once installed, open the GitHub Desktop application. Click “Sign in to GitHub.com” and sign in using your GitHub username and password. Click “Finish” on the next screen. You’re now ready to start using GitHub Desktop!
To create a new repository in GitHub Desktop, go to File and then click "New Repository"
On the top bar, notice that our current repository is shown. Next to that, our current branch, the default branch, is shown. This repository is currently available only on our local machine. To publish it to GitHub, let’s click “Publish repository.” Now when you navigate to your GitHub profile on github.com, you should see your newly created repository listed there. To work on this Repository: Click Open in Visual Studio Code/preferred text or code editor. Start doing your codes here.
A commit tells Git that you made some changes to files in your repository and you want to record those changes. To make our first commit To commit the changes, we should first write a commit message on the bottom left of the screen. When we’re ready to commit, we can simply click “Commit to main.” Your commit is currently local to your computer. If you want the changes to to show on GitHub, you must click “Push origin” on the next screen.