Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Introduction to Version control using Git and Github

The document provides an introduction to version control, specifically using Git and GitHub, explaining the purpose and benefits of version control systems. It details the types of repositories, the significance of Git as a distributed version control system, and popular Git hosting services like GitHub. Additionally, it outlines the steps for installing Git, setting up a GitHub account, and pushing a local project to a GitHub repository.

Uploaded by

ettolrahcava
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction to Version control using Git and Github

The document provides an introduction to version control, specifically using Git and GitHub, explaining the purpose and benefits of version control systems. It details the types of repositories, the significance of Git as a distributed version control system, and popular Git hosting services like GitHub. Additionally, it outlines the steps for installing Git, setting up a GitHub account, and pushing a local project to a GitHub repository.

Uploaded by

ettolrahcava
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction to Version Control

Using Git and Github


What Is Version Control?

A version control system, or VCS, tracks the history of changes as developers


and teams collaborate on projects together.

Developers can review project history to find out:

1. Which changes were made?


2. Who made the changes?
3. When were the changes made?, and
4. Why were changes needed?
What Is Version Control?

It refers to tracking and managing changes to source code in a repository. It is


a system that allow developers to:

1. Track the evolution of their code


2. Collaborate with others, and
3. Revert to previous versions of code if needed.
What is a Repository?

A Repository is a central location in which data is stored and managed. Each Git
project is called a repository, or “repo” for short. A repo stores all the files and changes
made to your project. We can single out two major types of Git repositories:

- Local repository
- Remote repository
Why Do We Need Version Control Systems?

• Streamlining the development process as multiple people can work


simultaneously on a single project.

• Management of code for multiple projects.

• Version control provides access to the historical versions of a project. This


is insurance against computer crashes or data loss. If any mistake is made,
you can easily roll back to a previous version. So it helps in recovery in case
of any disaster or unforseen/contingent situation.
Types of Version Control Systems

1. Distributed Version Control: Mercurial, Git and Bazaar.


2. Centralized version control systems: Concurrent Versions System
(CVS), Subversion (or SVN) and Perforce
What Is Git?

Git is a free, open-source distributed version control software that is used to track
changes in source code during software development.

It was created by Linus Torvalds in 2005.

Compared to other version control systems, Git is responsive, easy to use, and
inexpensive (free).
Git Hosting Services

Git hosting services are online platforms that allow multiple developers to work on
the same codebase from different locations by storing Git repositories in the cloud.

There are three popular Git hosting services:

1. GitHub (owned by Microsoft)


2. GitLab (owned by GitLab) and
3. BitBucket.
Github

GitHub is a web-based hosting service for Git repositories. GitHub was launched as a
company in 2008 and acquired by Microsoft in 2018.
Nowadays GitHub is the largest online storage space of collaborative works that exists
in the world.
GitHub has become the go-to hosting platform for projects using Git.
Installation & Setup
Installation & Setup

1. Download Git

Windows: https://gitforwindows.org/

Linux: https://git-scm.com/download/linux

Mac: https://git-scm.com/download/mac

2. Create Your Github Account

https://github.com
Installation & Setup
3. Configure GitHub Credentials

The global git username and email address are associated with commits on all
repositories on your system. Configure your local Git installation to use your GitHub
credentials by entering the following:

>> git config --global user.name "yourGithubUsername"

>> git config --global user.email "yourGithubEmail"

>> git config --global init.defaultBranch main


Installation & Setup

4. Once your github account is ready and you’ve configured your github
credentials. Then you can create a project (a folder containing a file) in your local
computer.

5. Next, create a repository on Github where you’d want to push your local project
to. It is advisable not to enable the readMeFile when creating your github repo.

6. Go to the directory of the local project you created earlier using your terminal
and run the following commands:
Installation & Setup
* Ensure you are in the directory of the project you want to push to your repo before you run
the following.

>> git init

>> git status

>> git add .

>> git commit -m "first commit to github"

>> git remote add origin remoteRepoProjectLink

>> git push -u origin main

Then, setup your personal access token (if it’s your first time pushing to github)

You might also like