Understanding Git For Beginners – Tutorial

by May 26, 2020IoT Programming

What is version control system?

• Easily management collaboration on a project
• Ability to have an unlimited number of developers working on the same code base
• Easily revert back your files if something happened

Types of Version control:

Centralized: These version control systems are based on the idea that there is a single “central” copy of your project somewhere (probably on a server), and programmers will “commit” their changes to this central copy.

Distributed: These systems do not necessarily rely on a central server to store all the versions of a project’s files. Instead, every developer “clones” a copy of a repository and has the full history of the project on their own hard drive. Hence the copy (or “clone”) has all of the metadata of the original.

Advantages Of Distributed Over Centralized Version Control:Advantages Over Centralized Version Control

1.Performing actions (except pushing and pulling) is extremely fast because the tool access the hard drive, not a remote server.

2,Everything except pushing and pulling can be done without an internet connection.

3.Once you have a group of change sets ready, you can push all of them at once.

4.Since each programmer has a full copy of the project repository,they can discuss the changes before deploying.

What is Git version control ?

Git is a system for tracking changes in source code during software development .

What is GitHub?

It can also be treated as a social platform to share knowledge and work. It also provides access control and several collaboration features,

While Git is a command line tool, GitHub provides a web-based graphical interface

A real life Example of how git works:

For example Carol is at city X and her mom is at city Y which is not nearby .

Carol’s mom wants to cook a dish and wants Carols’s help in it. They want to collaborate with each other in cooking this dish (building software)!

There are three utensils in this story — one master pan, where the actual food is being prepared, two ‘local’ pans; one for Jane and another for her mom, for them to experiment. They add stuff, balance ingredients, etc. in the ‘develop’ pan. In git terms, these are branches within a repository.

Once they find a mix that tastes good in the ‘local’ pan, they merge it with the ‘master’ pan !. And that’s how they commit each of their contributions towards the dish.

Who introduced it ?

Linus Torvalds One of he greatest programmer of the world who created Linux kernel introduced git.

“I name all my projects after myself. First Linux, now git.” Linus Torvalds

Downloading Git :

Git Download link visit

Getting started:

usage: git [OPTIONS] COMMAND [ARGS]

Step 1

Open Gitbash

opening git

Step 2

Introduce yourself to git:
git config –global user.name “your name”
git config –global user.email “your email”

Step 3

Change directory by using command or by using Gitbash here to whichever directory you want

Two Scenarios :

Scenario 1: single developer + local repository.

Scenario 2: multiple developers + remote central repository.

Lets go with the first scenario with simple commands:

git init

It creates an empty git repository. Creates the git directory: .git/

We have three stages :

So what is staging Area ?

General meaning of staging area according to Wkipedia “A staging area is a location where organisms, people, vehicles, equipment or material are assembled before use”

git add < filename >

git commit [-m “Commit message.”]

Records changes from the staging area to master.

git commit file1 file2

Records all changes of file1, file2 from working dir and staging area to master.

Examples:

$ git commit README -m “Added README.”

[master dbb4929] Added README. 1 files changed, 1 insertions(+), …

$ git log

commit dbb49293790b84f0bdcd74fd9fa5cab0…

Author:’ your name’ ‘your mail id’

Date: Wed May 15 00:08:46 2010 +0200

More commands

git diff
Shows what changes between working directory and staging area (index).

git log
Shows details of the commits.

git checkout
Get rid of what changed in (between working dir and staging area).

whenever you want to remove, move or rename a tracked file use git:
git rm filename
git mv oldname filename

Scenario 2: multiple developers + remote central repository

The below picture shows the how local repository is interfaced with the Remote repository

Below picture shows in and out of git workflow

Clone a repository in git version control:

git clone < URL >

Creates local copies of the whole remote repository.

Example: git clone https://github.com/abc/xyz.git

Merge a repository in git version control:

git merge

Joins development histories together.( It has to be fetched before to merge)

Push a repository in git version control:

git push


Updates remote masters (both Local and Remote). Requires fetch+merge first

Summary

Git Commands Tutorial [List OF Git Commands] - Tuts Make

Creating a multiplication Skill in Alexa using python

Written By Vishal Naik

Electronics Engineering student. Interested in Python and embedded systems development . I love research and share knowledge on current technology.

RELATED POSTS

Advanced Generics: Higher-Order Functions

Advanced Generics: Higher-Order Functions

In our journey through TypeScript generics, we've covered the basics, interfaces, and classes. Now, it's time to explore advanced concepts by combining generics with higher-order functions. These functions, which take other functions as arguments or return them,...

Basic Usage of Generics in Typescript

Basic Usage of Generics in Typescript

Keypoints Show how to declare generic functions and classes in TypeScript. Provide examples of generic functions that work with different data types. Demonstrate the use of built-in generics like Array<T> and Promise<T>. Here's the content...

Getting Started with Bash Script : A Simple Guide

Getting Started with Bash Script : A Simple Guide

Introduction In this tutorial, we will be looking into Bash Script - a tool used by developers to increase productivity and manage tasks. A lot of professionals use it for tasks such as system administration, data crunching, web app development, automated backups,...

How to Extract REST API Data using Python

How to Extract REST API Data using Python

Introduction In this tutorial, we will be discussing in detail on how to extract REST API data using Python. It is one of the most popular APIs and is used by a majority of applications. We will be using VS code editor for executing the python code. The extracted API...

Create a Simple ReactJs Application – Part 1

Create a Simple ReactJs Application – Part 1

ReactJs is one of the famous front-end open-source libraries of JavaScript developed by Facebook. It aims to allow developers to quickly create fast user interfaces for websites and applications. In this blog, we will create a simple and basic ReactJs...

Create a Simple ReactJs Application – Part 2

Create a Simple ReactJs Application – Part 2

In the tutorial's last part, we discussed about ReactJs and how to run a simple react app on a web browser. In this part, we will dig more into some interesting stuff, such as creating a home, about us, and contact pages. Click here for the first part - Create a...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....