Introduction to C# delegate and multicast delegate

What is a C# delegate?

The C# delegate is a reference data type that defines the method and their signature. The delegate stores the address of one or more methods. When a delegate for a method assigned, it behaves exactly like the method. It can be invoked like any other method with parameters and return value.
A delegate simply stores the reference of the methods with the same signatures such as return type and parameter list. A delegate can be invoked as like a class by creating an object for the delegate. The delegate object allows running the methods at run time without invoking it directly.

Usage of delegate:

When an event needs to be used then delegates can be used. Multicast delegates can be used for invoking many events at a time. When a class need to have more than one implementation of the method and to encapsulate a static method.

Refer for when to use delegates and interfaces -> https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ms173173(v=vs.100)

The Ultimate Managed Hosting Platform

Declaring a delegate:

The System.Delegate class is the base class for the delegate declaration. The delegate keyword is used to declare a delegate. The return type and parameters should same as the methods.

Eg:

public delegate int CalDelegate(int num1,int num2);

Instantiation and invoking delegates:

To instantiate a delegate, an instance is created similar to how a class instance is created. When a delegate is instantiated, the address of the method is stored in the instance.


Eg:
Calculator cal=new Calculator();
CalDelegate sumDel=new CalDelegate(cal.sum);
CalDelegate mulDel=new CalDelegate(cal.multiply);


CalDelegate is the delegate created and the sumDel is the delegate instance instantiated to CalDelegate with the reference to the sum() method in cal instance and mulDel is for reference of multiply() method.


To invoke the delegate, calling the delegate instance with the parameter list referenced by the delegate with the same data type.


Eg:
sumDel(10, 12);

mulDel(10,12);

using System;

public delegate int CalDelegate(int num1,int num2);
public class Calculator
{
	public int sum(int num1,int num2)
	{
		return num1+num2;
	}
	public int multiply(int num1,int num2)
	{
		return num1*num2;
	}
}
public class Program
{
	public static void Main()
	{
		Calculator cal=new Calculator();
		CalDelegate sumDel=new CalDelegate(cal.sum); // sumDel for sum() reference
		CalDelegate mulDel=new CalDelegate(cal.multiply); //mulDel for multiply() reference
		Console.WriteLine(sumDel(10,12));
		Console.WriteLine(mulDel(10,12));
	}
}

Output:

22

120

Multicast delegates:

To have a reference of more than one method in delegate multicast delegates is used. This mainly used in the multi-event invocation. The += operator is used to add the methods referred to delegate and -= operator is used to remove the methods. The methods are called in First-In-First-Out(FIFO) order.

Remember when using multicast delegates use void as return types because the use of multiple methods will clash in return type. So void is safe to avoid runtime exception.

Eg:

CalDelegate simpleDel=new CalDelegate(cal.sum);

simpleDel += new CalDelegate(cal.multiply);

simpleDel -= new CalDelegate(cal.sum);

using System;

public delegate void CalDelegate(int num1,int num2);
public class Calculator
{
	public void sum(int num1,int num2)
	{
		Console.WriteLine(num1+num2);
	}
	public void multiply(int num1,int num2)
	{
		Console.WriteLine(num1*num2);
	}
}
public class Program
{
	public static void Main()
	{
		Calculator cal=new Calculator();
		CalDelegate simpleDel=new CalDelegate(cal.sum);
		simpleDel+=new CalDelegate(cal.multiply); //multicasting using += operator
		simpleDel(10,12);
	}
}

Output:

22

120

The above delegate example is used with multicast delegates in which the firstsum()method is referenced to thesimpleDeldelegate. Thenmultiply()method is added to multicast using += operator. To remove the methods from delegate simply use -= operator. As said multicast delegate run in FIFO, firstsum()delegate reference is run and thenmultiply()with output 22 and 120 respectively.

For documentation of delegates refer -> https://docs.microsoft.com/en-in/dotnet/api/system.delegate?view=netcore-3.1

In next post, I will explain synchronous delegate, asynchronous delegate and covariance and contravariance delegates.

For my other C# archives -> Go.

If you enjoy my post please share it and if any suggestion please comment on it.

 1,479 total views,  1 views today

How to create C# List generics

C# List<T> generics

  • C# List<T> is a strongly typed collection for creating a list of objects of type <T>. 
  • It is similar to ArrayList, we can add, remove, search, sort, manipulate list-objects.
  • In C#, ArrayList is a non-generic collection whereas List<T> is a generic collection.
  • List<T> has high performance than ArrayList and type-safe. 
  • List<T> has similar methods and properties as the ArrayList.

Creating a C# List<T>

  • List<T> is created by using a new operator either it can be empty capacity or specify the size.

Syntax:

List<T> <list_name> = new List<T>(<capacity>);

  • <T> is the type of object to be created like int, float, double etc.
  • <list_name> name of the list.
  • <capacity> is the size of the list which is optional.

Eg:

List<string> List1 = new List<string>();

Adding object to List<T>

  • Add(T obj) method will add the element type <T> in the list on by one.

Eg:

List1.Add(“Element1”);

  • Insert(int index, T obj) method will add the element at the specified index.

Eg:

List1.Insert(1,”Element1”);

Removing object to List<T>

  • Remove(T obj) method will remove the element in the list.

Eg:

List1.Remove(“Element1”);

  • RemoveAt(int index) Removes the element at the specified index.

Eg:

List1.RemoveAt(1);

Get the size of List<T>:

  • Count property is used to get the size of the list.

Eg:

List1.Count();

To sort the List<T>:

  • Use the Sort() method to sort the array in ascending order.

Eg:

List1.Sort();

Accessing the elements in the List<T>

  • The index number can be used to access the elements like an array.

Eg:

List1[0] // accessing element at index 0;

  • To iterate over the List<T>, use foreach function.

Eg:

foreach(string str in List1)

{

Console.WriteLine(str);

}

Example:

using System;
using System.Collections.Generic;
					
public class Program
{
	public static void Main()
	{
		//create new List<T> of string type using new operator.
		List<string> list1=new List<string>();
		
		//Adding elements using Add(T) method.
		list1.Add("Element1");
		list1.Add("Element2");
		list1.Add("Element3");
		list1.Add("Element4");
		list1.Add("Element5");
		
		
		Console.WriteLine("Printing elements in list1");
		Console.WriteLine("Size of list1: "+list1.Count);//prinitng size of list1 using count
			
		//printing list1 elements using foreach
		foreach(string str in list1)
		{
			Console.WriteLine(str);
		}
		
		//removing 'Element1' 'Element2' using Remove(T) method.
		list1.Remove("Element1");
		list1.Remove("Element2");
		
		Console.WriteLine();
		
		Console.WriteLine("Printing elements in list1 after removing Element1, Element2");
		Console.WriteLine("Size of list1: "+list1.Count);//prinitng size of list1 using count
		
		//printing list1 elements using foreach
		foreach(string str in list1)
		{
			Console.WriteLine(str);
		}
		
		list1.Insert(2,"Element1");//inserting 'Element1' in index 2
		list1.Insert(4,"Element2");//inserting 'Element2' in index 4
		
		Console.WriteLine();
		
		Console.WriteLine("Printing elements in list1 after inserting Element1, Element2");
		Console.WriteLine("Size of list1: "+list1.Count);//prinitng size of list1 using count
		//printing list1 elements using foreach
		foreach(string str in list1)
		{
			Console.WriteLine(str);
		}
		
		list1.Sort();//sorting list1
		
		Console.WriteLine();
		
		Console.WriteLine("Printing elements in list1 after sorting");
		//printing list1 elements using foreach
		foreach(string str in list1)
		{
			Console.WriteLine(str);
		}
		
	}
}

Output:

Printing elements in list1
Size of list1: 5
Element1
Element2
Element3
Element4
Element5

Printing elements in list1 after removing Element1, Element2
Size of list1: 3
Element3
Element4
Element5

Printing elements in list1 after inserting Element1, Element2
Size of list1: 5
Element3
Element4
Element1
Element5
Element2

Printing elements in list1 after sorting
Element1
Element2
Element3
Element4
Element5

It is recommended to use List<T> generic over ArrayList since it is type-safe, high performance. 

To more refer:https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=net-5.0#remarks


For my other programming archives -> Go.

If any suggestions please comment about it.

 777 total views

Learn how to create C# ArrayList

ArrayList in C#

ArrayList is a type of non-generic collection framework available in the .Net framework for creating an array of objects list using C# language. The non-generic refers to that we don’t need to mention the data type of the array list. This array list can be dynamically defined of what size wanted. Unlike array initialization, we don’t need to specify the size of the list. It dynamically allocates size as we add or remove an element in the array list. Since it is a non-generic collection, the elements added to the array are stored as an object.

The basic operation we do in ArrayList add, remove, count, sort list. We can also do many operations such as reverse the ArrayList, get the index value of elements etc.

To view full properties and methods please refer: https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist?view=netcore-3.1

Create ArrayList

We can create an ArrayList using the ArrayList class and new operator.

using System;
using System.Collections;
					
public class Program
{
	public static void Main()
	{
		//array1 array list is created using new operator.
		ArrayList array1=new ArrayList();
		
	}
}

Add() method

Add(Object value) method will add the element to the ArrayList one after another.

using System;
using System.Collections;
					
public class Program
{
	public static void Main()
	{
		
		ArrayList array1=new ArrayList();
		//adding 5 elements to array1 using ADD() method.
		array1.Add("Element1");
		array1.Add("Element2");
		array1.Add("Element3");
		array1.Add("Element4");
	}
}

Remove()

Remove(Object value) method will remove the element mentioned.

using System;
using System.Collections;
					
public class Program
{
	public static void Main()
	{
		
		ArrayList array1=new ArrayList();
		//adding 5 elements to array1 using Add() method.
		array1.Add("Element1");
		array1.Add("Element2");
		array1.Add("Element3");
		array1.Add("Element4");
		
		Console.WriteLine("Before removing");
		//output of array1 before remove
		foreach(string str in array1)
		{
			Console.WriteLine(str);
		}
		
		//removing Element4 and Element3 from array1 arraylist using Remove().
		array1.Remove("Element3");
		array1.Remove("Element4");
		
		Console.WriteLine("After removing");
		//output of array2 after remove
		foreach(string str in array1)
		{
			Console.WriteLine(str);
		}
		
	}
}

Output:

Before removing
Element1
Element2
Element3
Element4
After removing
Element1
Element2

In the above program, foreach used to iterate through array1 ArrayList to display the elements.

Using indexers [<index_number>] we can access the elements in the array list.

The output shows the elements in array1 before and after remove() method is used.

  • To get the no of elements in the ArrayList use Count property.
  • To sort the ArrayList use Sort() method.
  • To check an element is contained in the ArrayList use Contains() method.
		//get the count of elements in array1
		Console.WriteLine(array1.Count);
		//to sort the array1
		array1.Sort();
		//check element contains in an array and return true if it contains the element else return false
		Console.WriteLine(array1.Contains("Element1"));

Some other methods are

Insert(int index,object value)

  • Use to insert the element at the given index.

RemoveAt(int index)

  • Removes the element at the given index.

BinarSearch(object value)

  • Search for an object using binary search.

Clear()

  • Clear all the elements in ArrayList.

IndexOf(object value)

  • Gets the index of the particular object.

For other operations refer .NET docs.


For other C# archives -> Go.

For my other programming archive -> Go.

 1,408 total views

C# interface and multiple interfaces tutorial

What is interface?

The definitions for a group of related functionalities that a non-abstract class or struct can declare is called an interface. The interface is another way of abstraction in C#. The interface is like the abstract class but it only contains the methods definitions, whereas the abstract class contains all methods, fields, constants definitions. Unlike the abstract class, the interface cannot have a constructor. The interface methods should be abstract and public. The interface only provides the definition for the methods. In C# multiple inheritances cannot be done in class but by means of the interface.

The interface in C#:

  • Members in the interface should be abstract and public only no other access specifier used.
  • By interface, we can’t able to create an object like an abstract class.
  • Interface only define the methods, the class needed to override and implement those methods.
  • The interface doesn’t contain a constructor.
  • The interface contains methods and properties but not fields.

Implementation of C# interface:

The interface keyword used to implement the interface. We can also implement multiple interfaces for a single class in C#. It’s suggested to use I before every interface name to identify it has the interface. To use an interface in a class we use (:) to access the interface. For example, demo as interface name then use IDemo.

Syntax:

interface <interface_name>
{
    method definition;
}
class <class_name>:<interface_name>
{
interface_method declaration;
}

Example:

using System;
	
interface IDemo1
{
	void simpleInterface();
}

public class Demo:IDemo1{
	public void simpleInterface(){
		Console.WriteLine("Implementation of Idemo1 interface");
	}
}
public class Program
{
	public static void Main()
	{
		Demo d=new Demo();
		d.simpleInterface();
		Console.ReadLine();
	}
}

Here I implement an interface called IDemo1. Then I use the IDemo1 interface in Demo class using the operator (:). Then I implement the interface method simpleInterface by declaring an output statement which displays Implementation IDemo1 interface.

Multiple interfaces:

To use multiple interfaces, simply use a comma between the interfaces name in class. The above program can be implemented as multiple interfaces with another interface called Idemo2.

using System;
	
interface IDemo1
{
	void simpleInterface1();
}

interface IDemo2
{
	void simpleInterface2();
}
public class Demo:IDemo1,IDemo2{
	public void simpleInterface1(){
		Console.WriteLine("Implementation of Idemo1 interface");
	}
	
	public void simpleInterface2(){
		Console.WriteLine("Implementation of Idemo2 interface");
	}
}
public class Program
{
	public static void Main()
	{
		Demo d=new Demo();
		d.simpleInterface1();
		d.simpleInterface2();
		Console.ReadLine();
	}
}

From C# 8.0 onwards we can implement a default implementation for the interface methods itself. We can also use other access specifiers such as private, protected, internal, public, virtual, abstract, override, sealed, static, extern. We can also implement static methods in interfaces.

For reference https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#drawbacks

For my other programming post -> Go.

 711 total views

What is docker networking and bridge networking?

In docker we can connect two or more containers or non-docker system using networking. Whether it is a windows or Linux containers, docker network helps to connect them in an easy way. This may helpful for beginners who interested in docker.

There are different network drivers available in docker networking

  • bridge:
    The default network driver if we don’t mention a network driver when running a container. It is created automatically when a container is created. It is best for standalone containers
  • host:
    If you use the host network mode for a container, that container’s network stack is not isolated from the Docker host, and the container does not get its own IP-address allocated.
    For instance, if you run a container which binds to port 80 and you use host networking, the container’s application is available on port 80 on the host’s IP address.
  • overlay:
    Overlay is mainly used when we want to connect multiple containers to create a swarm service to communicate between them.
  • macvlan:
    Macvlan networks allow you to assign a MAC address to a container, making it appear as a physical device on your network. The Docker daemon routes traffic to containers by their MAC addresses.
  • The other driver is called none, which is used when we use third party plugins from docker hub.

Bridge networking tutorial

This tutorial explain how a two standalone containers can be connected by bridge network. Here we create two alpine linux containers namely alpine1 and alphine2, then connect them using bridge.
We can view the network list using the command

docker network ls

You may see different network listed as bridge, host, none as following image. Any newly created network also listed here.
Docker_network_ls
Next create two alpine containers as alpine 1 and alpine 2 with following command

docker run -dit --name alpine1 alpine 
docker run -dit --name alpine2 alpine

The two container created as follows
container_create
Then inspect the bridge network to view details of the containers connected to it with the following command

docker network inspect bridge

This will display a JSON format of bridge network details. We could see that by default alpine1 and alpine2 has bridge networks with different IP address as 172.17.0.2/16 and 172.17.0.3/16 respectively .
network_inspect
Now connect to the alpine1 container using attach command

docker attach alpine1

Now attach to the container and ping a website say google.com -c 2 make 2 limit of ping.

Then try to ping the alpine2 container using the IP 172.17.0.3/16 and check they are connected. If it ping correctly then successfully two containers are connected using bridge.

ping -c 2 172.17.0.3/16

docker_networking_bridge
For other docker archive -> go.
For network reference of docker -> go.

 1,178 total views

The difference between ADD and COPY in dockerfile.

When I was seeing some examples for docker file image building, I came across two things of same functionalities. They are COPY and ADD instructions. This article gives the difference between ADD and COPY in dockerfile. Next it explains how similar they are, then the best practice for using the RUN instead of ADD instruction.

ADD instruction

ADD instruction is an older one, which job is to copy the file or directory from a source to destination.
The ADD instruction can also do operations such as extraction of compressed files or download from an URL path.
Here the source may be a local compressed tar file or the URL path.
If it is a tar file, it extracts the contents to the destination else if it is an URL, then it download the file and extract to the destination in a similar way.
If authentication needs for URL file we can use RUN with curl or wget to download the files.
Since, ADD degrades in performance of the docker containers, COPY is been introduced for simple job.
Syntax for ADD:

ADD <src> <dest>

A simple example to ADD used for local tar file called source.tar.xz to the destination folder /dest.

ADD sourcefile.tar.xz /dest

This syntax example gives how the URL path called https://example.com/source.tar.xz file is downloaded and copied to the /dest.

ADD https://example.com/source.tar.xz /dest

COPY instruction

COPY instruction copies the file or directory from a source path to the destination.
Its job is simple as it duplicates the source file or directory to the destination.
It doesn’t include the operation of extraction or downloading files as ADD instruction.
Syntax for COPY:

COPY <src> <dest>

An example to COPY a file called source.txt to the destination folder /dest.

COPY sourcefile.txt /dest

What to use either COPY or ADD?

In dockerfile we use COPY many time because it only copies the file from a source to destination.ADD used when there is a purpose such as local tar files or URL file source.
For best docker practice, we can use RUN instruction instead of creating an extra layer.
RUN instruction with curl or wget used to get the file direct into the destination.
The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.

ADD https://example.com/source.tar.xz /usr/src/things/
RUN tar -xJf /usr/src/things/source.tar.xz -C /usr/src/things

For instance take the above sentence, where a file called source.tar.gz is downloaded using ADD and extracted using tar with RUN instruction.
This makes two layers that worse the docker performance.
It simply done using RUN with curl tool as follows within a single layer.
If, there is direct copy operation needed than COPY instruction is recommended.
The below dockerfile only takes single layer of operation of file download using curl and then extraction of file using tar with RUN instruction.

RUN mkdir -p /usr/src/things \
    && curl -SL https://example.com/source.tar.xz \
    | tar -xJC /usr/src/things 

Reference to the Best docker practices -> go.
For my docker archives click here -> go.
If any queries please comment it.

 1,120 total views

Docker containers introduction and working

Docker is an open source platform to develop, ship and run an application in an isolated way using docker containers. Container is an unit of software that packages all dependencies such as binaries and libraries required to run an application.
Containers are not new technologies, since from 1979 used in UNIX system. The below article give a detailed info about container evolution from dzone.
The Evolution of Linux Containers and Their Future 
Docker containers isolate from each other but share the same Linux kernel system. This uses the kernel namespaces and cgroups to manage application. Docker containers can deployed in separate and managed as usual application.

Docker containers vs Virtual Machines

The Docker also use virtualization as Virtual Machines. But it uses OS level virtualization, whereas VM uses hardware level virtualization. Docker shares the Operating system kernel, VM shares the hardware. This makes docker more efficient than VM. Consider the following picture which illustrates the difference between Docker and VM.

docker vs VM

In VM architecture, it uses the Hypervisor to manage the Guest OS on it. Each Guest OS has different binaries and libraries for running software applications. In docker, it shares the Linux kernel to run all applications with its own dependencies.

These dependencies packaged as image called docker images. Docker images deployed as containers to run the application in an isolated environment. These  containers are run on docker engine.

docker architecture
Docker architecture

Docker Images

Images are simple templates that instructs to create the containers. Each image even built from another images itself. These images can be build using the dockerfile. dockerfile is a file which instructs to build an image using other images and dependencies. Even the syntax for writing the dockerfile is simple language. Each line in the dockerfile creates a layer to run a container. The registries such as docker registry, cloud registries include docker hub, Amazon ECR, Azure container registry.

Docker Containers

Container are the runnable instances using the docker images. It packages all the bins and libraries needed to run the application in an isolated environment. Docker CLI and Docker API can used to create, delete, start, stop containers using the Docker daemon. Each container has its own networks, storage, and configs. Container can connect to another container using its networks . When a container deleted, the storage in the container also removed. Here we can use the persistent storage for storing the data instead of containers.

Docker daemon

Docker daemon(dockerd) uses Docker API manages the all docker objects in the docker environment. These objects are containers, images, storage, networks. The docker daemon communicates with other daemons for container management and network communication.

Docker client

Docker client(docker) is the interactive way we can execute the API to manage docker system. To manage the docker daemon the docker API called using docker command.

Registry

Docker images are stored in the registries. Docker hub is a public registry, we can create and push the image in this docker hub. docker pull, docker push commands used to pull and push docker images from the registry. Cloud technologies also provide registries such as Amazon ECR by AWS, Azure container registry by Azure cloud.

Docker installation

Docker can be installed natively in Linux and Mac OS since it uses linux namespaces and cgroups for working. In windows, docker can be installed with some dependencies. Docker desktop, a GUI based docker tool is available for Windows and Mac OS
The following link give the documentation for installing docker in Mac OS, Windows and Linux distros.

Running our first docker container

First, check the docker is installed on your system using following command

$ docker --version
Docker version 19.03.8, build afacb8b7f0

Now, we run our first container hello-world image. If image is not present in our local system, it pulls those image from docker hub and runs it.

$ docker run hello-world

Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    ca4f61b1923c: Pull complete
    Digest: sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7
    Status: Downloaded newer image for hello-world:latest

    Hello from Docker!
    This message shows that your installation appears to be working correctly.

To list the container running in the system use ps command.

 $ docker ps --all

    CONTAINER ID     IMAGE           COMMAND      CREATED            STATUS
    54f4984ed6a8     hello-world     "/hello"     20 seconds ago     Exited (0) 19 seconds ago

To list the images pulled use

$ docker image ls

The next post will be about building a docker image.

For docker reference refer this docs -> go.

For my programming article refer this -> go.

If any suggestions or queries please comment it.

 1,312 total views

How to get remote repository and commit files in git

Git commands that are commonly used for managing project files such as ‘init’, ‘add’, ‘commit’, ‘status’, ‘log’.

 438 total views

Git commands

The last Git article illustrates how the git version control system works. This article will help you to learn how to get a remote git repository and commit files in git. You also get knowledge about git basic commands for remote repositories and commit files in git repository as local.

Getting a git repository

To get an existing git repository either from the local system or online repositories such as Github, bitbucket we can use the ‘clone’ command.
The format for getting a repository is as follows

$ git clone 

For example, consider the following syntax

$ git clone https://github.com/example.git

Initializing a repository

Initializing a repository refers to initialize the repository which is needed to be git i.e to be tracked. This is done using the ‘init’ command.To initialize a repository use the following command

$ git init

Go to the folder you need to be tracked and execute the ‘init’ command.
This creates a new file called .git the file that is where the git keeps of the files that are stored in it in the form of encryption.

Next, we need to stage the files that need to be tracked. This is done using ‘add’ command. The staging files refer to set the which files in the repositories are needed to be tracked in the git.
To stage a file

$ git add README.md

Instead of README.md replace with the file name needed to be staged.
To stage all files specify ‘.’ to add all files in the repository.

$ git add .

Next, we need to commit the files that was staged using the ‘commit’ command.

$ git commit

To commit the files we need to specify commit messages for all commits using ‘-m or –message’ specification in ‘commit’ command.

$ git commit -m 'Added new files'

Tracking a repository

To track the file status we can use ‘status’ in the git command.

$ git status

The status will show you the changes that are changed if any as follows.

On branch master
Changes not staged for commit:
    (use "git add ..." to update what will be committed)
    (use "git checkout -- ..." to discard changes in working directory)
        modified:   README.md
no changes added to commit (use "git add" and/or "git commit -a")

If no changes are made in the files it displays the message as follows

On branch master
nothing to commit, working tree clean

To view the log of the files committed to the git we can use the ‘log’ command.
This log command will give you all the logs about the commit done to the files in git.

$ git log

This will output the log as follows

commit 9222b1d10ed1741a2e7ddde50a264a729dc9c85d (HEAD -> master)
Author: AjeethT 
Date:   Thu Jul 16 15:48:54 2020 +0530

The first line gives the commit hash value next it specifies the branch as a master. Next are the author’s name and the timestamp of the commit.

The full flow of the git operation are as follows:

$ git init
$ git add README.md
$ git commit -m 'Initial commit'
$ git status

In the next git post, I will be sharing on different operations on the git repository.
Click here for Git archives.
To view official git documentation please visit git docs.

As I’m new to the blog, I trying to improve the contents daily. Please support it through comments.
If the article is helpful or any thought please comment on me.

 438 total views