Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Git Interview Questions and Answer Part – 10

Where can HEAD point?

  • To a branch
  • To a branch or nowhere
  • To a branch or a commit (Ans)
  • To a branch, a commit, a tree, or a blob

How does “git rebase” move an existing commit?

  • It copies over the commit to a new commit with a different parent and SHA1. (Ans)
  • None of these
  • It just changes the parent in the commit file.
  • It changes the commit’s parent and its SHA1.

What’s one difference between merges and rebases?

  • Rebases change history, merges don’t. (Ans)
  • None of these
  • Rebases create commits with multiple parents, merges don’t.
  • Merges create a new commit object, rebases don’t

What’s a “pull”?

  • A “merge” followed by a “push”
  • A “push” followed by a “merge”
  • A “fetch” followed by a “push”
  • A “fetch” followed by a “merge” (Ans)

Which of these is not a Git command?

  • git fetch
  • git fork (Ans)
  • git push
  • git clone

The setting, core.autocrlf, configures:

  • automatic addition of line breaks to commit messages.
  • autocorrection of spelling errors in commit messages.
  • conversion of line endings between the repository and working copy. (Ans)
  • stripping extra line breaks from the end of files.

Which command creates a local git repository?

  • git localrepo
  • git init (Ans)
  • git repo
  • git initrepo

Performing a git pull is equivalent to a git fetch followed by:

  • git merge (Ans)
  • git rebase
  • git cherry-pick
  • git reset –hard

Cherry-picking a commit will:

  • apply only that commit to the current branch. (Ans)
  • remove the commit from its source branch and apply it to the current branch.
  • apply that commit and all subsequent commit to the current branch.
  • apply that commit and all previous commits to the current branch.

The advantage of a DVCs is:

  • full local history
  • easy backups
  • all of these (Ans)
  • reliable branching/merging
  • different topologies

To remove and discard the changes from the last commit on your current branch, you should use:

  • git reset –soft HEAD
  • git revert HEAD
  • git revert HEAD~1
  • git reset –hard HEAD
  • git reset –hard HEAD~1 (Ans)

Which URL style should you use if you want to avoid using passwords?

  • http://github.com/username/repository.git
  • git@github.com:username/repository.git (Ans)
  • git://github.com/username/repository.git
  • https://github.com/username/repository.git

Given an unmerged feature branch, feature1, what is the effect of running “git branch -d feature1”?

  • Deletion of feature1 will fail silently
  • feature1 will not be deleted and an error message will be displayed (Ans)
  • Git will display the prompt “Unmerged changes. Confirm delete? (y/N)”
  • feature1 will be deleted

User-level configuration in Git can be modified using:

  • git config –system
  • git config
  • git config –user
  • git config –global (Ans)

Which file lists the files and directories that should not be committed to the repository?

  • .git/config
  • .gitnocommit
  • .gitattributes
  • .gitignore (Ans)

What feature in Git allows you to become more efficient at the command line?

  • Speech recognition
  • Keyboard shortcuts
  • Snippets
  • Aliases (Ans)

When is a commit A said to be reachable from another commit B?

  • When B is an ancestor of A
  • When A is the direct parent of B
  • When A and B are patch equivalent
  • When A is an ancestor of B (Ans)

How can Git calculate patches on the fly?

  • It’s really good at math.
  • It uses the patience algorithm.
  • It stores the entire files in the working directory for each commit. (Ans)
  • It stores deltas between files in the working directory.

What is the difference between the -S and -G options of git log?

  • -S searches for matching lines that are removed, while -G searches for lines that are added.
  • -S searches for matching lines that are either added, removed, or modified, while -G only includes lines that are modified.
  • -S searches for matching lines that are either added or removed, while -G also includes lines that are modifie- (Ans)
  • -S searches for matching lines that are either added or removed, while -G also includes lines that are modified.

In which scenario is git rerere useful?

  • When dealing with complex merge conflicts
  • When merging more than two branches
  • When dealing with a lot of different merge conflicts
  • When dealing with the same merge conflict more than once (Ans)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

What is Git and use cases of Git?

What is Git? Git is a distributed version control system (DVCS) planned to track changes in source code during software development. It was developed by Linus Torvalds…

Read More

What is GitOps?

GitOps is a modern approach to managing and automating the deployment and operation of applications and infrastructure using Git as the single source of truth. In GitOps,…

Read More

What is Git LFS and use cases of Git LFS?

What is Git LFS? Git LFS (Large File Storage) is an extension of the Git version control system that addresses the challenge of managing large files and…

Read More

How to Use GitOps for Agile Development?

Are you tired of traditional development methods that are slow and cumbersome? If so, you may want to consider GitOps for agile development. GitOps is a relatively…

Read More

How to Use GitOps for Continuous Integration?

Are you tired of constantly manually updating your application infrastructure? Do you want a more efficient way to manage your continuous integration process? Look no further than…

Read More

How to Use GitOps for Continuous Delivery?

Are you tired of manually deploying your applications and updates? Are you looking for a more efficient way to manage your software development process? Look no further…

Read More