Git and GitHub: A Comprehensive Guide for Beginners
Table of Content 1.Introduction to Git and GitHub 2.Git installation 2.1Configure Git 3.Creating a Repository 3.1Create a Repository on GitHub 3.2Link Local Repo to GitHub 4.Making Commits 5.Pushing and Pulling Changes 5.1 Push to GitHub 5.2 Pull from GitHub 6.Conclusion Introduction to Git and GitHub Version control in the world of software development, is very essential. Whether you're working solo or collaborating with a team, tools like Git and GitHub help you track changes, collaborate effectively, and avoid catastrophic errors. Git is a distributed version control system (DVCS) that helps developers track changes in their codebase, collaborate efficiently, and revert to previous versions if needed. GitHub, on the other hand, is a cloud-based platform that hosts Git repositories, providing additional collaboration features like pull requests, issue tracking, and project management tools. While Git works locally, GitHub makes it easier to share and collaborate online. In this guide, we'll cover: i. Setting up Git ii. Creating a repository iii. Making commits iv. Pushing and pulling changes v. Basic Git workflows Git installation Before using Git, you need to install it and configure it with your identity. To install Git, click the link Git - Downloads to download and install based on your OS (Windows, Linux, macOS) 2.1 Configure Git Once installed, click on the Git bash icon on your computer to set your global username and email: git config --global user.name "Your Name" git config --global user.email"you@example.com" 3.Creating a Repository A repository (repo) is where Git tracks file changes. You can create one locally or on GitHub. To initialize a Local Repository, Open Git bash On Git bash portal, run the following commands; • cd Documents • mkdir git-lab • cd git-lab • git init # Initializes a new Git repo 3.1 Create a Repository on GitHub To create a repository on Github, follow the guide below. i.Go to GitHub and click New Repository. ii.Enter a name (e.g blucon-first-repo). iii.Choose Public or Private. (in this case, Public) iv.Click Create Repository. 3.2 Link Local Repo to GitHub If you initialized a local repo first, connect it to GitHub: To do this, go to the Git bash portal and run the command below; • git remote add origin https://github.com/Blucon83/blucon-first-repo.git • git push -u origin master 4.Making Commits A commit is a snapshot of changes in your repository. Check File Status by going to Git bash and run the following commands; • git status • git add readme.md • git status • git commit -m "Adding a readme file" 5.Pushing and Pulling Changes 5.1. Push to GitHub Upload your local commits to GitHub: On the Git bash portal run the command below; • git push -u origin master # First push (sets upstream) • git push # Subsequent pushes 5.2 Pull from GitHub Fetch and merge remote changes: On the Git bash portal run the command below; • git pull origin master This command merges changes from GitHub into your local branch. (Always pull before push to avoid conflicts.) 6.Conclusion Git and GitHub are essential tools for modern software development. By mastering basic commands (init, commit, push, pull), you can efficiently manage code versions and collaborate with others. Practice by creating a sample project, making changes, and pushing to GitHub. Over time, explore advanced features like branching strategies, GitHub Actions (CI/CD), and collaboration workflows.

Table of Content
1.Introduction to Git and GitHub 2.Git installation 2.1Configure Git
3.Creating a Repository
3.1Create a Repository on GitHub
3.2Link Local Repo to GitHub
4.Making Commits
5.Pushing and Pulling Changes
5.1 Push to GitHub
5.2 Pull from GitHub
6.Conclusion
Introduction to Git and GitHub Version control in the world of software development, is very essential. Whether you're working solo or collaborating with a team, tools like Git and GitHub help you track changes, collaborate effectively, and avoid catastrophic errors.
Git is a distributed version control system (DVCS) that helps developers track changes in their codebase, collaborate efficiently, and revert to previous versions if needed.
GitHub, on the other hand, is a cloud-based platform that hosts Git repositories, providing additional collaboration features like pull requests, issue tracking, and project management tools. While Git works locally, GitHub makes it easier to share and collaborate online.
In this guide, we'll cover:
i. Setting up Git
ii. Creating a repository
iii. Making commits
iv. Pushing and pulling changes
v. Basic Git workflowsGit installation
Before using Git, you need to install it and configure it with your identity.
To install Git, click the link Git - Downloads to download and install based on your OS (Windows, Linux, macOS)
2.1 Configure Git
Once installed, click on the Git bash icon on your computer to set your global username and email:
git config --global user.name "Your Name"
git config --global user.email"you@example.com"
3.Creating a Repository
A repository (repo) is where Git tracks file changes. You can create one locally or on GitHub.
To initialize a Local Repository,
Open Git bash
On Git bash portal, run the following commands;
• cd Documents
• mkdir git-lab
• cd git-lab
• git init # Initializes a new Git repo
3.1 Create a Repository on GitHub
To create a repository on Github, follow the guide below.
i.Go to GitHub and click New Repository.
ii.Enter a name (e.g blucon-first-repo).
iii.Choose Public or Private. (in this case, Public)
iv.Click Create Repository.
3.2 Link Local Repo to GitHub
If you initialized a local repo first, connect it to GitHub:
To do this, go to the Git bash portal and run the command below;
• git remote add origin https://github.com/Blucon83/blucon-first-repo.git
• git push -u origin master
4.Making Commits
A commit is a snapshot of changes in your repository.
Check File Status by going to Git bash and run the following commands;
• git status
• git add readme.md
• git status
• git commit -m "Adding a readme file"
5.Pushing and Pulling Changes
5.1. Push to GitHub
Upload your local commits to GitHub:
On the Git bash portal run the command below;
• git push -u origin master # First push (sets upstream)
• git push # Subsequent pushes
5.2 Pull from GitHub
Fetch and merge remote changes:
On the Git bash portal run the command below;
• git pull origin master
This command merges changes from GitHub into your local branch.
(Always pull before push to avoid conflicts.)
6.Conclusion
Git and GitHub are essential tools for modern software development. By mastering basic commands (init, commit, push, pull), you can efficiently manage code versions and collaborate with others.
Practice by creating a sample project, making changes, and pushing to GitHub. Over time, explore advanced features like branching strategies, GitHub Actions (CI/CD), and collaboration workflows.