DevOps Interview Questions and Answers – Part 2

25 Apr

DevOps is an essential skillset for all developers and operations people nowadays. It is so embedded into the SDLC that one must know answers to certain interview questions. DevOps interview questions are mostly covered in all kinds of interviews, even if you applied for different roles.

I have already covered the basics of DevOps in Part 1 of this series.

In this series we will mostly see questions based on DevOps tools and technologies. I’ll not cover answers for most of these questions, as these are very common questions and you can easily find good answers using Google. However, I will give some hints whenever necessary.

 

 

Version Control System – Git Interview Questions

What is version control System?

It is also called source control or revision control system or Source Code Management. Please Google for a complete answer.

Why version control?

Key points:

  • Backup and recovery
  • Track previous changes
  • Collaboration between team members and different teams
  • Gated merging, review control
  • Maintain different environment using branches

What is Git?

Google

What are the other tools for version control?

TFS, SVN, CVS, etc.

What is the difference between Git and SVN?

Google

What is the difference between Git and GitHub?

GitHub is hosted Git

What is the difference between Centralized VCS (Version Control System) and Distributed VCS?

Google

What is SubGit?

Google

What are the advantages of Git?

Google

How do you configure a specific user for the Git?

git config --global user.name "jinal.desai"
git config --global user.email "[email protected]"
git config --list

You can prepare other git commands from the interview perspective.

git init
git status
git clone
git add
git commit
git push
git pull
git log
git show
git diff
git branch
git reflog
git stash
git ls-tree

Why we need .gitignore file?

Google

What is stashing in Git? How can you do it?

Google

What is cherry picking in Git? How can you do it?

Google

What is tagging in Git? How can you do it?

Google

How you can rollback your changes you committed using Git?

Google

How can you resolve a merge conflict using Git?

Google

What is “git reset”?

Google

What is the difference between “git pull” and “git fetch”?

Google

What is the difference between “git merge” and “git rebase”?

Google

What is “git bisect”?

Google

What is Git Squash?

Google

What are Git Hooks? What different Git Hooks are available?

Google

What is “bare repository” in Git?

Google

What is GitLab? What is the difference between GitHub and GitLab?

Google

What is the difference between GitHub and BitBucket?

Google

What is the difference between fork, branch and clone?

Google

What is the difference between reverting and resetting?

Google

What is the staging area (or index) in Git?

Google

What does a commit object contain?

  • Set of files
  • Reference to parent commit objects
  • An SHA-1 name, 40 characters string

What is the difference between HEAD, working tree and index in Git?

Google

 

 

 

Scenario based advanced questions

For the experienced candidate, it’s better to ask scenario-based questions.

What are the steps to resolve a (merge) conflict using Git?
How do you resolve conflicts in Git?

Google

How do you revert (rollback changes) a commit that is already pushed?

Google

How do you revert a commit that is already merged with the master (main) branch?

Google

How do you find list of files that are changed in a particular commit?

git diff-tree -r {commit hash}

Can you recover a deleted branch? How?

Google

What work is restored when you recover a deleted branch?

Google

How do you stash the last 5 commits into a single commit?

git reset -soft HEAD~5 &&git commit

How can you find that the current branch is merged or not?

git branch --merged
git branch --no-merged

What is the best branching strategy?

What is the best Git branch strategy? | Git Best Practices
Git Branching Strategies: GitFlow, Github Flow, Trunk Based…

How can you fix a broken commit?

Google

How to remove a file from the Git repository without removing it from the file system?

Google

How can you determine the source of a bug introduced in some recent commits?

Hint: By using “git bisect”

How can you run code sanity checking tools before even committing the code?

Hint: Git Hooks

How do you integrate Git with Jenkins?

Hint: Via plugins

 

 

Conclusion

In the next part we will cover questions on IaC (Infrastructure as Code) tools. Let me know in the comment if I miss any interview question regarding version control system in this article.



Leave a Reply

Your email address will not be published. Required fields are marked *