---
# System prepended metadata

title: 'My Git and GitHub Learning Experience: A Beginner-Friendly Guide'

---

# My Git and GitHub Learning Experience: A Beginner-Friendly Guide

Learning the concept of Git and GitHub for the first time can be overwhelming. You're just beginning your web development journey, and the first topic you encounter is around Git, GitHub, and the terminal. You immediately feel like, "This is not for me." But if someone else was able to comprehend it, then you can too. There's nothing magical about it.

For beginners, the terminal seems like a foreign language, and Git concepts sound complex. I was in this category the first time I had to use the command-line interface. Learning is a gradual process. From using the wrong commands, reading the error messages, and implementing the corrections, to creating problems and finding solutions, you will discover the flexibility of using the terminal over the GUI (Graphical User Interface), and you'll have Git commands at your fingertips.

Git and GitHub are must-have skills for every developer. They allow developers to work on the same project and track changes while being in different locations. I will share all I have learned about Git and GitHub. It might not be exhaustive, but it will move you away from the category of people who consider the whole concept a magic. At the end of this, you will be able to set up your Git and GitHub accounts and be able to interact and work seamlessly between them.

**What is Git?**

Git is a decentralized version control system for tracking changes in computer files. This means you don't need a central server to use it. Git has the ability to copy the entire codebase to every developer's local machine (computer). Version control, on the other hand, is a software practice that involves controlling, organizing, and tracking changes in the history of computer files.

Think of Git as a tool that helps you revert to previous changes you made in a file without losing them. This allows developers to experiment freely without fear of ruining their entire project.

**Features of Git**

* Version control
* Tracking changes
* Collaboration
* Branching
* Staging area
* Open-source and free

**What is GitHub?**

GitHub is a remote web-based platform where developers can contribute, collaborate with others, and host Git repositories. **Repositories** are simply folders on GitHub that store your code and make it accessible to others. You can view it as a social network for developers where they share their projects.

Git and GitHub work together seamlessly. Git is the tool you use to manage your code locally, while GitHub is the platform where you can store and share your code with others. You'll need both Git and GitHub to work efficiently, Git to manage your code locally and GitHub to share it with the world.

**Setting up Git**

In the following steps, I'll outline how to install Git on your system using the terminal.

* Open your terminal and type the command `git --version `(note the two dashes) to check if you already have Git installed.

* If Git is installed, you'll see the version number. If not, you'll see an error message.

* For Linux users: Type the command `sudo apt install git-all` in your terminal. The installation will begin. Follow the prompts carefully, and Git will be installed.

* For macOS and Windows users: There are separate installation instructions available online. You can find the Git installation guide [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

**Setting up GitHub**

To set up a GitHub account, head to [github.com](https://github.com/) and fill out the required information to create an account. You can personalize your profile further by adding details about yourself and your work.

**Configuring Git and Github**

**Setting a Git Username**:

* Open your terminal and type the command 
```
git config --global user.name “<your-username>"
```
* Ensure to replace my name with your own username, preferably your GitHub username. 

* Confirm the username has been set using
```
git config --global user.name
```

**Setting your commit email address in Git:**
* Open your terminal and type in the command 
```
git config --global user.email “<your-email>”
```

* Confirm the email using 
```
git config --global user.email
```

**Adding SSH keys to your account**

Secure Shell Protocol (SSH) keys allows you to authenticate your account one-time using a private key file on your local machine. This enables you to push to your Github account without using the password always. Read more about this and set it using the guide from [Github documentation](https://docs.github.com/en).

**Git Workflow**

1. Working Directory (Untracked file)

* The first step is to create your working folder and open it in your Visual Studio Code. Files created here are untracked by Git, meaning Git doesn't know about them yet.

To confirm this, run the command 
```html
git status
```

* The result will be an error message saying "not a git repository."

* Now, run the command `git init` to initialize an empty Git repository within your project.

* Confirm again by running git status. This time, it will tell you "On branch 'main', no commits yet."

2. **Staging Area**

* To stage your work and prepare it for a commit, use the command:

```h
git add <name of file to be staged>
```

You can stage all the file at the same time using the command
```
git add .
```
This command prepares the file to be included in the next commit.

3. **Commit Area**

A commit is like taking a snapshot of the staged files. It is telling Git, okay!, this file is ready to be pushed to Github. To commit your staged file, Use the command:
```
git commit -m "Your Commit Message"
```

Always include a clear and concise commit message that explains the changes you've made. This helps you and others understand the purpose of the commit.

4. **Branching**

While not always necessary for personal projects, branching is crucial for collaborative work. If you are working on your personal project, first set the default branch to main, if it is on master. This is to make it tally with default branch on Github.

Set the default branch to 'main' using the command
```htmlembedded=
git branch -M main
```
If you are collaborating with other developers, branching is a must. To Create a new branch us the command
```htmlembedded
git checkout -b "branch_name"
```
This command creates a new branch with the specified name and switches to that branch.

5. **Adding a Remote Origin**

Before pushing your code to a remote repository on GitHub, you need to link your local repository to the remote repository.

* First create a new repository on GitHub:

* Go to your GitHub profile.

* Click on "Repositories" and then "New."

* Enter your repository name and make it public. Private means only you can view it.
* When this is done, it will bring up an interface containing some instructions similar to the image below.

![Screenshot from 2025-01-29 08-25-04](https://hackmd.io/_uploads/HyShKODdJx.png)

* Get the SSH URL
* If you have set up your SSH key already, change the button from HTTPS to SSH and copy the 6th line of command.


* Add the remote origin by pasting the command in your terminal

* Verify the remote origin by running the command `git remote`. The output should display "origin."

6. **Pushing to GitHub**

Now your project is ready to be pushed to your remote repository.
* If you are pushing for the first time to that repository run the command
```htmlembedded=
git push -u origin main
```
* You can simply use git push in the future.

7. Pull Requests

If you're working on your personal project and branched out or if you are working in a team, there is a need to create a pull request. Pull request is simply asking for your work to be reviewed and added to the main branch.

To create a pull request
* Go to your GitHub repository and click on the "Pull Requests" button.
![Screenshot from 2025-01-29 08-42-12](https://hackmd.io/_uploads/BJSupdwO1x.png)


* Click "New pull request."

* Write a clear description of your changes and submit the pull request.

8. **Merging**

Merging is accepting the pull request and adding your implementation to the main file. If you're working with a team, the team lead will typically review and merge pull requests.

If you're working on a personal project and created a branch, you can review and merge your own pull request into the main branch.

Branching, pull requests, and merging help you maintain a clean and organized workflow, preventing conflicts and ensuring that changes are properly reviewed and integrated to avoid messing the whole project.

**Conclusion**
If you have followed me from the beginning until now, I believe that working with Git and GitHub won't sound foreign to you anymore. Finally, I want to let you know that no one learns by running away from their mistakes. The more mistakes I made and rectified, the better I got at using Git and GitHub. You'll learn the same way. Don't let those error messages discourage you, because they can be frustrating. Read them carefully, try to understand what went wrong, and then try again. 

**Resources**
1. Getting Started - Installing Git
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
2. Github Documentation
 https://docs.github.com/en
3. Git & GitHub Crash Course 2025
https://www.youtube.com/watch?v=vA5TTz6BXhY