JOBSEEKER?

Git Interview Questions

Practice for Git interviews by solving TestDome questions. Our interview questions are used by more than 7,000 companies and 450,000 individual test takers.

Jobseekers: Certify Your Knowledge

Take a Certification Test

Companies: Use Our Tests for Screening

Buy a Pack Of Candidates

These Git interview questions are examples of real tasks used by employers to screen job candidates such as web developers, front-end developers, back-end developers, and others that require knowledge of source control and collaborative development.

1. Force Checkout

Command Line Arguments
   
Easy 

A developer is experimenting with code on a local copy of a branch. After a while, it is decided that this experiment does not work. So the developer decides to switch back to the master branch. However, the developer's local working copy is different from the HEAD.

Which of these options would allow the developer to successfully check out the master branch?

(Select all acceptable answers.)

Use the --force option of the checkout command.
Wipe the local copy from the drive and clone the project again.
Use the --quiet option to suppress error messages during checkout.
Use the --orphan option to remove the experimental code entirely.
Use the stash command to save the modifications separately.
   


2. Saving a Bugfix

Command Line Arguments
   
Easy  

Write down a sequence of GIT commands (with no additional arguments) to download a repository, update a file, and save the changes back to the original repository. Assume that other developers didn't modify the file.

  1. Download the master repository to a local directory or repository:
    git https://joe@testdome.com/testdome.git
     
  2. Fix a bug in file test.cpp
     
  3. Mark that file test.cpp has been changed:
    git test.cpp
     
  4. Save the changes to the local repository:
    git -m 'Bug with testing is fixed'
     
  5. Send the changes to the original repository:
    git origin master
   


If you feel ready, take one of our timed public Git Interview Questions tests:
DevOps Practices

DevOps Test (Easy)

Git

Git Test (Easy)

Not exactly what you are looking for? Go to our For Jobseekers section.
Dashboard Start Trial Sign In Home Tour Tests Questions Pricing For Jobseekers