Site icon TestingDocs.com

Getting Started with Git Version Control

What is Git

Git is a popular distributed version control system. It’s a distributed version control system. Such a system is most useful when you work in a team collaborating and managing changes in the application code.

Official website:https://git-scm.com/

 

Git command line

Installing Git on Windows operating system. ( https://www.testingdocs.com/installing-git-on-windows-10/ )

Installing Git on Ubuntu Linux

https://www.testingdocs.com/install-git-on-ubuntu-linux/

What is GitHub

GitHub is the most popular repository hosting website. It is an online website that allows us to host Git repositories. We can host both public as well as private code repositories.

Official website: https://github.com/

 

Version control

Version control keeps a record of who made what changes and when of the product development as shown in the below picture. It can be used like the undo feature, it’s always possible to go back in time to see exactly who wrote what on a particular day, or what version of a program was used to generate a particular set of results.

 

 

 

 

Some of the most frequently used git commands are listed below:

Configuring git environment

How to set your Name and Email:

git config –global user.name “Your Name”

git config –global user.email   your@emailaddress.com

The tool stores this information in the ~/.gitconfig  file.

Getting help

git help command

Repository creation

Create a repository in the current directory:   git init
Clone a remote repository into a subdirectory:   git clone URL

Branches

Switch to branch:   git checkout branch
List local branches:  git branch
Merge changes from branch:  git merge branch

Remote repositories

Fetch changes from a remote repository:  git fetch  <remote>
Fetch and merge changes from a remote repository:  git pull   <remote>
Push changes to a remote repository:  git push   <remote>
List remote repositories:   git remote

Record changes to the repository: git commit

Pushing and pulling changes gives us a reliable way to share work between different people and machines.

 

Git Tutorial on this website can be found at:

https://www.testingdocs.com/git-tutorials/

For more details on the Git, visit the official website at:

https://git-scm.com

Exit mobile version