Here we have compiled the most probable DevOps interview questions asked in the industry. You will learn about software version control, Git repository, reverting a commit in Git, Vagrant, continuous testing elements, and the importance of continuous integration, testing, and deployment. These questions are curated after discussing with many interviewers and DevOps Training experts.
A $ git diff command lists you the changes between the commits.
For example: $ git diff < commitId1 > < commitId2 >
‘Git Status’ shows your changes status in the working directory and the index area, it is helpful in understanding a git more comprehensively.
‘git diff’ is similar to ‘git status’, but "git diff" shows the differences between various commits, and "git status" shows the difference between local repo and the working directory and index.
A ‘git checkout’ updates your directories or specific files of your working tree. And to switch from one branch to another.
To switch among branches "git checkout
To jump to specific commit "git checkout
To remove the file/s from the staging area and also from the working directory ‘git rm’ is used.
It is possible to start your work form where you have left, ‘git stash apply’ command is used to bring back the saved changes to the working directory.
GIt Log command shows you the commit history. To get specific histories of your project, there are some commands listed below:
$git log //shows complete history of your repository files.
$git log --oneline //shows all history but in one line.
$git log -n5 //shows last 5 commits history.
$git log --follow
$git log --author
‘git add’ adds file/s from the working directory to your index area.
Of Course creating a new commit is suggested then to edit the existing commit because, Amend operation will destroy the state of existing commit. If it is just a commit message changed then that is not a problem. But if the contents are changed then chances of eliminating something important remains more.
The command ‘git Reset’ is used to reset your index as well as the working directory to the state of your last commit. By doing this you left with zero changes in your working directory.
2023 Gamut Gurus Pvt Ltd, All rights Reserved.