Shivanand Mishra
7 min readMar 28, 2021

--

Basic DevOps Interview (part 1)

1. What is Source Code Management?

It is a process through which we can store and manage any code. Developers write code, Testers write test cases and DevOps engineers write scripts. This code, we can store and manage in Source Code Management. Different teams can store code simultaneously. It saves all changes separately. We can retrieve this code at any point of time.

2. What are the Advantages of Source C ode Management?

Helps in Achieving teamwork . Can work on different features simultaneously . Acts like pipeline b/w offshore & onshore teams . Track changes (Minute level) . Different people from the same team, as well as different teams, can store code simultaneously (Save all changes separately)

3. Available Source Code Management tools in the market? There are so many Source Code Management tools available in the market. Those are . Git . SVN . Perforce . Clear case Out of all these tools, Git is th e most advanced tool in the market where we are getting so many advantages compared to other Source Code Management tools.

4. What is Git?

Git is one of the Source Code Management tools where we can store any type of code. Git is the most advanced tool in the market now. We also call Git is version control system because every update stored as a new version. At any point of time, we can get any previous version. We can go back to previous versions. Every version will have a unique number. That number we cal l commitID. By using this commit ID, we can track each change i.e. who did what at what time. For every version, it takes incremental backup instead of taking the whole backup. That’s why Git occupies less space. Since it is occupying less space, it is ve ry fast

5. What are the advantages of Git?

Git stores every update in the form of versions. For every version, it takes incremental backup instead of taking the whole backup. Since it is taking less space, Git is very fast. That incremental bac .Parallel branching:kup we call “Snapshot” We can create any number of branches as per our requirement. No need to take prior permission from any one, unlike other Source Code Management tools. Branching is for parallel development. Git branches allow us to work simultaneously on multiple features. .Fully Distributed:A backup copy is available in multiple locations in each and everyone’s server instead of keeping in one central location, unlike other Source Code Management tools. So even if we lose data from one server, we can recover it easily. That’s why we call GIT as DVCS (Distributed Version Control System)

6. What are the stages in Git?

There are total of 4 stages in Git 1. Workspace:- It is the place where we can create files physically and modify. Being a Git user, we work in this work space. 2. Staging area/Indexing area:- In this area, Git takes a snapshot for every version. It is a buffer zone between workspace and local repository. We can’t see this region because it is virtual. 3. Local repository:- It is the place where Git stores all commit locally. It is a hidden directory so that no one can delete it accidentally. Every commit will have unique commit ID. 4. Central repository:- It is the place where Git stores all commit centrally. It belongs to everyone who is working in your project. Git Hub is one of the central repositories. Used for storing the code and sharing the code to others in the team.

7. What is the common branching strategy in Git?

Product is the same, so one repo. But different features.  Each feature has one separate branch  Finally, merge (code) all branches  For Parallel development  Can create any no of branches  Can create one branch on the basis of another branch  Changes are personal to that particular branch  Can put files only in branches (not in repo directly)  The default branch is “Master”  Files created in a workspace will be visible in any of the branch workspaces until you commit. Once you commit, then that file belongs to that particular branch.

8. How many types of repositories available in Git?

There are two types of repositories available in Git Bare Repositories (Central) These repositories are only for Storing & Sharing the code All central repositories are bare repositories Non – Bare Repositories (Local) In these repositories, we can modify the files All local /user repositories are Bare Repositories

9. Can you elaborate commit in Git? Storing file permanently in the local repository we call commit.  For every commit, we get one commit ID  It contains 40 long Alpha-numeric characters  It uses the concept “Check some” (It’s a tool in Linux, generates binary value equal to the data present in file)  Even if you change one dot, Commit-ID will get changed  Helps in tracking the changes

10. What do you mean by “Snapshot” in Git? It is a backup copy for each version git stores in a repository.  Snapshot is an incremental backup copy (only backup for new changes)  Snapshot represents some data of particular time so that, we can get data of particular time by taking that particular snapshot  This snapshot will be taken in Staging area in Git which is present between Git workspace and Git local repository.

11. What is GitHub?

Git hub is central git repository where we can store code centrally. Git hub belongs to Micro soft Company. We can create any number of repositories in Git hub. All public repositories are free and can be accessible by everyone. Private repositories are not free and can restrict public access for security. We can copy the repository from one accoun t to other accounts also. This process we call as “Fork”. In this repository also we can create branches. The default branch is “Master”

12. What is Git merge?

By default, we get one branch in git local repository called “Master”. We can create any no of branches for parallel development. We write code for each feature in each branch so that development happens separately. Finally, we merge code off all branches in to Master and push to central repository. We can merge code to any other branch as well. But merging code into master is standard practice that being followed widely. Sometimes, while merging, conflict occurs. When same file is in different branches with different code, when try to merge those branches, conflict occurs. We need to resolve tha t conflict manually by rearranging the code.

13. What is Git stash?

We create multiple branches to work simultaneously on multiple features. But to work on multiple tasks simultaneously in one branch (i.e. on one feature), we use git stash. Stash is a te mporary repository where we can store our content and bring it back whenever we want to continue with our work with that stored content. It removes content inside file from working directory and puts in stashing store and gives clean working directory so t hat we can start new work freshly. Later on you can bring back that stashed items to working directory and can resume your work on that file. Git stash applicable to modified files. Not new files. Once we finish our work, we can remove all stashed items fo rm stash repository.

14. What is Git Reset?

Git Reset command is used to remove changes form staging area. This is bringing back file form staging area to work directory. We use this command before commit. Often we go with git add accidentally. In this c ase if we commit, that file will be committed. Once you commit, commit ID will be generated and it will be in the knowledge of everyone. So to avoid this one, we use Git reset. If you add “ fhard” flag to git reset command, in one go, file will be removed rom staging area as well as working directory. We generally go with this one if we fell that something wrong in the file itself.

15. What is Git Revert?

Git Revert command is used to remove changes from all 3 stages (work directory, staging area and loca l repository). We use this command after commit. Sometimes, we commit accidentally and later on we realize that we shouldn’t have done that. For this we use Git revert. This operation will generate new commit ID with some meaningful message to ignore previ ous commit where mistake is there. But, here we can’t completely eliminate the commit where mistake is there. Because Git tracks each and every change.

16. What is container?

The container is like a virtual machine in which we can deploy any type of applications, soft wares and libraries. It’s a light weight virtual machine which uses OS in the form of image, which is having less in size compare to traditional VMware and oracle virtual box OS images. Container word has been taken from shipping containers. It has everything t o run an application.

17. What is virtualization?

Logically dividing big machine into multiple virtual machines so that each virtual machine acts as new server and we can deploy any kind of applications in it. For this first we install any virtualization software on top of base OS. This virtualization software will divide base machine resources in to logical components. In a simple terms, logically dividing one machine into multiple machines we call virtualization.

18. What is Docker?

Docker is a tool b y using which, we create containers in less time. Docker uses light weight OS in the form of docker images that we will get from docker hub. Docker is open source now. It became so popular because of its unique virtualization concept called “Containerizati on” which is not there in other tools. We can use docker in both windows and Linux machines.

--

--

Shivanand Mishra

DevOps | Solution architect | Cloud Engineer | AWS SysOps Admin | Automation | Product enthu | Ex: Amazon, Airtel, Simplilearn, Paytm