#IBelieveInDoing September Challenge — Developer Essential Linux and Git

After completing my previous #IBeliveInDoing Challenge of OOP Concepts of July Edition, I was very much fascinated by the learning methodology.

So when I came to know about this month’s developer essential track of Linux and Git Basics, I soon registered for that. First, let me tell you something about Linux and Git and why it is named as developer essentials. And after that, I will explain what I learned during this challenge with Crio.

#IBeliveInDoing September Challenge

Linux and Git are considered two very basic and most used platforms/tools in the Developer Community, and knowledge of these two will always give you an edge over others and adds value to your developer skills. Linux is the most commonly used OS for servers all across the world. Also, the recent developments in UI of Desktop versions have no doubt has attracted the developer community to use it more than previously. Apart from that Linux is Highly Secure, More stable, Runs on any Hardware, easy maintenance and ease of use, and Open Source. And the great news is It is Free. ;) Also it has a great support community.

So now What is Git and Why Should we use it. Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all to be merged into one source. So regardless of whether you write code that only you will see, or work as part of a team, Git will be useful for you. Git is a software that runs locally. Your files and their history are stored on your computer. You can also use online hosts (such as GitHub or Bitbucket) to store a copy of the files and their revision history. Having a centrally located place where you can upload your changes and download changes from others, enable you to collaborate more easily with other developers. Git can automatically merge the changes, so two people can even work on different parts of the same file and later merge those changes without losing each other’s work!

Understand Git in 100 seconds

Here’s A Quick representation of How Git works.

My Learning with Crio

The total Challenge was Divided into 3 Modules named Linux Basics 1 , Linux Basics 2, and Git Basics.

Linux Baiscs 1

In starting a few milestones of this module I was introduced with some basic Linux commands to get familiar with. Before that I have to set up the Linux Environment to try hand on with the commands. Since I was not having a Linux machine at that moment I used the gitpod.io workspace to practice all commands. Please feel free to use this by clicking over the link. I found it very useful. It uses Dockers to manage the environment and uses the github.com directory as your workplace to save your files. I got acquainted with the Linux terminal and I found it kind of cool to use it. It is very flexible and gives you the feel of being a developer. Then I understand how the Linux Directories are structured and how we can manipulate files and directories using some basic Linux commands. After completing these basic milestones covering the basics, I was given a task to analyze the Hadoop Log Files using some Linux commands. And really It was an exciting task to do.

Linux Directory Structure

Linux Basics 2

This Module was a bit advanced with the previous one and it gave me some more depth knowledge of Linux OS, Networking, and its working. Since I was facing complexity running these commands on gitpod.io workplace as it does not support that much, so I finally decided to install Linux (Ubuntu) on my machine in Virtual Box. In the initial module, I tried hands-on with commands that help me to understand the processes running in the OS. How we can monitor the different processes and obtain their process IDs. Also created some new process and kill it using commands. Then in the next milestone, I learned the commands that help me to get details of my machine, and it was quite interesting that this information is already present in OS in /proc/cpuinfo, and you can know them by typing simple commands.

Then I moved to the networking portion where I created a dummy server and client process using Netcat command. I tried some cool stuff like chatting from two terminals and passing messages from server two browsers and many more, which was quite fun. :) Apart from that I learned how using ifconfig command we can get out networking details and trace back the paths using the ping command. Also, I did many cool kinds of stuff between client and server in two-terminal using ping and tcpdump commands like capturing the ping information on server-side and all. But wait all these things are not limited to commands. Linux gives you a special ability to write a code of sequential commands where you can program a whole task to complete in one go. This functionality is called a shell. Linux allows you to write shell scripts like other traditional programs we wrote in Languages like C/C++ and Java. Linux also supports python scripting. You can write python scrips also to automate the commands in Linux. So all these advantages must have convinced you to use Linux. If not then try yourself and surely you will fall for it.

Git Basics

Git projects are called Repositories and contain Git related files apart from the project files we add. These git files contain info about all the changes made — who made the changes, what changes were made, when was it made etc. Similar to having Google Drive for file sharing, we have version control providers like GitLab, GitHub etc. to facilitate the use of Git repositories.

Git is a verison control software. Version Control softwares help us keep track of changes to our files by taking snapshots of them. We can look at earlier snapshots and also restore our code to an earlier snapshot. This lets us work on our projects without worrying about introducing errors to partly/completely working versions and not being able to go back.

Git is one of them, probably the most popular one.

In this module, I learned most reguired git commands that every developer should know while using Git. Intitially it was bit confusing how to use and how to work with Git. There were a lot of hefty words realted to Git and also since you are reading this you have probably heared alot of them till now, but belive me it was very much intresting and easy once you had tried some hands on with it. Since I am using both Linux and Windows OS, I wanted to try it with both of them. So First I installed git on Windows and Linux. After setting up I started with initialising gloabal user for my native Git application. I initialised it with my gitlab account and genrating the ssh key for that so I don’t require a password each time when I tried to push my local repository to remote repostiory. Then I cloned a balnk remote repository from gitlab to my machine. This cloned repository is called a local repository and the one present on gitlab server is called remote repository. For better understanding see this structure below.

After that I practice few commands like how to get code from remote repository and how to upadte mine on remote repository from local one. I tried and understand how I can work with Linux and Git along with each other hand in hand. Also I understand how to sync the work with remote repository and when did merge conflict occurs and how to handel them. As a final take away I understand the basic flow of using Git and how to handel them using commands. The basic workflow of Git is :

  • You modify files in your working directory
  • You stage the files, adding snapshots of them to your staging area (`git add file`)
  • You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your local Git repository (`git commit file`)
  • You push the changes from the local repository to the remote repository (`git push`)
  • You pull the changes from the remote repository to the local repository (`git pull`)

Often though, developers only learn a few simple commands and overlook the power of Git history and the other things that Git can do to make you much more efficient. For example, managing releases is very easy with Git using git tags.

Git is more powerful than a lot of developers think. So practice it , use it and be master of it , becuase it’s Git ;)

--

--