Version Control Assignment GIt & Git Hub
Version Control Assignment GIt & Git Hub
University
Assignment On
Topic: Documentation on Version Control (Git
+ GitHub)
Course Title: Data Structure & Algorithm
Course Code: PGD 211
Submitted to
Rafid Mostafiz
Assistant Professor
IIT( Institute Of Information Technology)
Noakhali Science and Technology University
Submitted By
Name : Emran Al Mahmud
Roll No : 202415001
Semester : 02
Batch No : PGDIT 15
1. Introduction ................................................................................................................ 2
9. Conclusion ............................................................................................................... 17
Page | 1
1. Introduction
Version control is a system that helps developers track changes to code over time. It is
useful for managing projects, fixing errors, and working in teams. Git is a popular
version control tool that lets users work offline and save changes step-by-step.
Developers can create branches to test new features without affecting the main code.
GitHub is an online platform that stores Git projects and allows easy sharing and
teamwork. It includes tools like pull requests, issue tracking, and more. This
document explains how Git and GitHub work and why they are important in software
development today.
Version control is a system that helps manage and track changes made to files over
time. It is mainly used in software development to monitor code updates, but it can
also be used for other types of documents. Version control allows developers to save
different versions of their work, compare changes, and return to an earlier version if
needed. This is especially helpful when fixing bugs or recovering lost code.
There are two main types of version control: centralized and distributed. In
centralized systems, all files are stored on a single server. Developers must be
connected to that server to make changes. In distributed systems like Git, every
developer has a complete copy of the project on their own computer. This allows
them to work offline and sync with others when needed.
Version control also supports team collaboration. When multiple people work on the
same project, version control helps prevent conflicts and confusion. Each person can
work on their own part, and later merge their changes with the main codebase.
Overall, version control makes software development faster, safer, and more
organized. It keeps a full history of the project, making it easy to manage, track
progress, and avoid mistakes.
Page | 2
3. Types of Version Control
There are three main types of version control systems: Local, Centralized, and
Distributed.
Distributed systems are now the most widely used due to their reliability and ability to
support team collaboration effectively.
Page | 3
4. What is Git?
Git is a free and open-source version control system used to manage and track
changes in source code. It was created by Linus Torvalds in 2005, the same person
who developed Linux. Git helps developers keep a history of changes, work on
different parts of a project through branches, and collaborate with others easily.
Unlike older systems, Git is a distributed version control system (DVCS). This
means every developer has a full copy of the project on their computer. They can
work offline, and later sync their changes with others. Git also allows users to go back
to previous versions of the code, fix mistakes, and experiment safely without harming
the main project.
Git is fast, secure, and now widely used in software development worldwide.
05.What is GitHub?
GitHub is a web-based platform used to store and manage Git repositories online. It
helps developers work together on code, share projects, and track progress. While Git
is the tool that tracks code changes on your computer, GitHub lets you upload that
code to the internet so others can see it, use it, or help improve it.
GitHub provides useful features like pull requests, issue tracking, project boards,
and collaboration tools. Teams can review code, fix bugs, and discuss improvements
all in one place.
GitHub was launched in 2008 and is now owned by Microsoft. It supports both open-
source and private projects and is widely used by developers around the world.
Page | 4
06.How to Work on Github
GitHub is user-friendly and very easy to get started with. All we need to understand
the terms like fork, clone, pull requests, etc.
Now we will create our very first repository on GitHub. - navigate to + icon and
select New Repository option -
It will open a new page asking about repository information like Repository
name, description and whether we want to make our project private or public, etc.
Fill the information and click Create repository button. Now we have successfully
created our first repository on GitHub.
Neat. As we can see we have our first repository on GitHub ready to grow as we work
Page | 5
Step 3: Install and set up Git
I have created a detailed tutorial on how to use Git. If you are not familiar with Git
uses and work-flow, it is recommended to read it first.Here is quick Git setup needed
to get started -
Download Git - Depending on your operating system download Git and follow the
installation window.
Right-click and select Git Bash option to initialize Git inside the project folder –
Set email -
Git
Copy
Set name -
Git
Copy
Now we will clone the remote repository to our local system. This is because we will
be working on our local repository and pushing the change to GitHub repository very
frequently.
Navigate to the Github and click on Clone or Download button. It will open a
dropdown with our remote repository address.
Page | 6
Navigate to the location where you want to clone the repo. Right click and select ->
Git Bash option
Git
Copy
So we will be running -
Git
Copy
Now we are ready to work with this repository freely and make required changes.
Let's see how do we do it.
Let's start by updating our README.md file. Open it with your favorite editor and
make the changes. I update the content inside the README.md file.
Page | 7
Step 6: Add changes to the staging area
Now it is time to track changes and stage them. To check the status we run - git status
Let's add the changes to the staging area by running the git add . command -git add
Now if again run git status command, we see the newly created file has been tracked.
Now it is time to track changes and stage them. To check the status we run - git status
Let's add the changes to the staging area by running the git add . command -git add .
Now if again run git status command, we see the newly created file has been tracked.
Git
Copy
The commit message is written in quotes. This message will be saved with the
particular revision we did.
Page | 8
Great. So far, we have created a repository on GitHub, set up Git tool, cloned it on our
local system, made changes, added changes to the staging area and committed those
changes.
But our local changes are yet to be pushed to our remote repository.
It is time to push these changes to the server. To push the changes to remote -
git push
That is all. We have successfully pushed all our local changes to our remote
repository. If we goto our remote repository which we created, we can see that change
we made has een updated on GitHub.
Page | 9
So, now our basic work-flow is, every time we make any changes(modification,
adding new files or deleting unused ones) to the local repository -
Note that, it is must to commit changes before pushing it to the remote server.
Open the project directory with your favorite code editor( I am using Visual Studio
Code) -
Page | 10
07.Git Workflow (with Image)
Before starting any project, ensure Git is installed and configured correctly.
Install Git
If you don’t have Git installed, download and install it from Git’s official website.
After installation, configure Git with your user details. These details are associated
with your commits.
Configure Git
This creates a .git directory that tracks your project’s changes. If you’re working on
an existing project, you can clone the repository:
Page | 11
2) Branching Strategy: Organizing Your Code
Branches are the foundation of Git workflows. Using branches effectively allows you
to isolate work, collaborate efficiently, and keep your production code stable.
Types of Branches
main (or master) branch: The stable branch that always holds production-
ready code.
develop branch: An integration branch for combining features before release
(used in Gitflow).
Feature branches: Used for developing specific features or bug fixes. These
branches are temporary and merged back when the work is complete.
Create a New Branch
Before starting new work, ensure your main or develop branch is up-to-date:
checkout main
git pull origin main
Now, create a new branch for your feature:
/new-feature
This isolates your changes, keeping the stable branch clean.
The Feature Branch Workflow is ideal for teams and individual developers. It
isolates development work into dedicated branches, ensuring the main branch remains
stable.
Steps:
Page | 12
4) Push your branch to the remote repository:
Key Branches:
Page | 13
git checkout develop
git merge release/v1.0.0
git push origin develop
5) For production bugs, use a hotfix branch:
Rebasing is a powerful Git feature that allows you to integrate changes from another
branch while maintaining a linear commit history. This is ideal for reducing noise in
your project’s history and avoiding unnecessary merge commits.
Steps:
If conflicts arise, Git will pause the rebase and indicate the files in conflict.
Open the conflicted files, resolve the conflicts, then stage them:
git add <file>
Continue the rebase:
git rebase --continue
If necessary, you can abort the rebase and return to the original state:
git rebase --abort
3) Push the rebased branch to the remote:
The Forking Workflow is essential for open-source projects where contributors don’t
have direct access to the main repository.
Page | 14
Steps:
1) Fork the repository into your GitHub account.
2) Clone the forked repository locally:
git add .
git commit -m "Fix bug in login functionality"
git push origin feature/contribution
5) Submit a pull request to the original repository.
Page | 15
8. Benefits of Using Git & GitHub
To be honest, nearly every open-source project uses GitHub to manage its project.
Using GitHub is free if your project is open source and includes a wiki and issue
tracker that makes it easy to include more in-depth documentation and get feedback
about your project. If you want to contribute, you just fork a project, make your
changes and then send them a pull request using the GitHub web interface.
2. Documentation
By using GitHub, you make it easier to get excellent documentation. Their help
section and guides have articles for nearly any topic related to git that you can think o
Are you a developer and wish to attract recruiters? GitHub is the best tool you can
rely on for this. Today, when searching for recruits for their project, most companies
look into GitHub profiles.
4. Markdown
Markdown allows you to use a simple text editor to write formatted documents.
GitHub has revolutionized writing by channeling everything through Markdown:
from the issue tracker to user comments, everything. With so many other
programming languages to learn for setting up projects.
5. GitHub is a repository
This was already mentioned before, but it’s important to note, GitHub is a repository.
This means that it allows your work to get out there in front of the public. Moreover,
GitHub is one of the largest coding communities around right now, so it’s wide
exposure for your project.
When multiple people collaborate on a project, it’s hard to keep track of revisions—
who changed what, when, and where those files are stored. GitHub takes care of this
problem by keeping track of all the changes that have been pushed to the repository.
Page | 16
Much like using Microsoft Word or Google Drive, you can have a version history of
your code so that previous versions are not lost with every iteration.
7. Integration options
GitHub can integrate with common platforms such as Amazon and Google Cloud,
services such as Code Climate to track your feedback, and can highlight syntax in
over 200 different programming languages.
In conclusion, GitHub offers a multitude of benefits that can significantly enhance the
software development process for individuals and teams alike. From simplified version
control and seamless collaboration to robust project management and extensive community
support,
9. Conclusion
Page | 17
10. References
Page | 18