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.
If you are in the middle of a job and you need to jump to another job, use the 'git stash' command. git stash records the current state of your working directory & index, and gives you a clean working directory which matches the HEAD. So you can jump to another job, by this you won't lose your changes/edits. And you can un-stash to get your previous changes back to the working directory. To see what changes you stashed use 'git stash list' this will list you the changes and 'git stash pop' will get back your changes to the working directory.
When you don't need the stashed changes and want to remove it from the stashed list, run the git 'git stash drop' command. By default it will remove the last added stash item, and to remove a specific item you include it as an argument 'git stash drop < stash_name >'.
This command 'git branch --merged master' will list the branches that have been merged into the master. Use the '-a' flag to show local and remote branches and '-r' to view only remote branches.
The git clone creates a copy of an existing remote repository into a local, command to clone a git repository is "git clone < remote_repo_url >".
As we know git is a version control tool it keep track of all commits done by each and every user, so git should have user data like name and email, git never allow user to commit without this details, so user need to configure git using this command,
git config --global user.name "your_name"
git config --global user.email "your_email"
A 'commit' points to the specific version of the project looked like at a certain point of time.
a) A set of files/directories, representing the state of a project at a given point of time.
b) Reference to parent commit(s) objects
c) Time stamp.
With all these info git commit has a unique id known as SHA id or SHA value.
Create a directory for the project if it does not exist, and go into the directory then run the command ‘git init’. A directory by name .git will be created in the project directory.
HEAD is simply a reference to the last commit in the current working branch. In every repository, there will be a default head known as "Master". A repository can contain any number of heads. When you checkout to any branch the HEAD revision changes to the latest commit of the new branch. We directly will not create head but when we commit, git creates a reference to that commit known as head.
The purpose of branching in GIT is that you can create any no.of branches and jump between those branches. It will allow you to go to your previous work in one branch keeping your recent work intact in another branch. For example you can create a branch for main release and a branch for bug fix after completion of job in one branch. You can merge the code to master by this. You can work parallely with multiple jobs and you will have a safe code in master.
A common way to create a branch in GIT is to maintain one as "Main" branch and create another branch to develop new features. Generally used branches are Feature branch, Release branch and Hotfix branch. This pattern is useful for multiple developers working on the same project.
Contact us for your training requirements! Exchange ideas, develop relationships, and stay up-to-date with emerging practices in the ever-evolving DevOps & Cloud arena.
2023 Gamut Gurus Pvt Ltd, All rights Reserved.
3rd floor, Sigma Tech Park Gamma Block, Varthur kodi, Whitefield, Bangalore, Karnataka-560066
#1080, 2482 Yonge Street, Toronto, ON M4P 2H5 Canada