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 – 7

How to Compute object ID and optionally creates a blob from a file?

  • git hash-object (Ans)
  • git cat-file
  • git update-ref
  • git count-objects

How to Update the object name stored in a ref safely?

  • git hash-object
  • git cat-file
  • git update-ref (Ans)
  • git count-objects

Which commands will Reference logs or record when the tips of branches and other references were updated in the local repository.

  • git log
  • git reflog (Ans)
  • git update-ref
  • git count-objects

git stores different types of objects in .git/objects. Which is wrong objecst type?

  • commit
  • tree
  • blob
  • parent (Ans)

How to show the contents of the hashed files in .git/objects?

  • git show
  • git reflog
  • git log
  • git cat-file (Ans)

How to shows us the type of the object represented by a particular hash?

  • git cat-file -t (Ans)
  • git cat-file -p
  • git cat-file -k
  • git cat-file -type

How does “git rebase” move an existing commit?

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

What happens to unreachable objects in the database?

  • They immediately get deleted.
  • You can never make an object unreachable in Git.
  • They stay there forever, in case you want to retrieve them.
  • They can eventually get garbage-collecte- (Ans)

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)

Can an object in Git be safely modified?

  • No: you might get the same SHA1 as another object.
  • No: if you changed even one bit, then you’d get a different object with its own SHA- (Ans)
  • Yes: you can edit the content of the file that stores the object.
  • Yes: you can ask Git to generate a new SHA1 for the object.

What are the four types of objects in the Git database?

  • Blobs, Trees, Commits and Versions
  • Files, Directories, Commits and Tags
  • Blobs, Trees, Commits and Annotated Tags (Ans)
  • Blobs, Trees, Commits and Branches

What happens when you commit?

  • The current branch changes, HEAD doesn’t. (Ans)
  • HEAD changes, the current branch doesn’t.
  • Neither HEAD nor the current branch change.
  • Both HEAD and the current branch change.

Which objects are created when you merge?

  • Zero or one commit and nothing else
  • Merges don’t create new objects.
  • Zero or one commit, and possibly new trees and blobs (Ans)
  • Exactly one commit and nothing else

Where can HEAD point?

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

Which of these is not a Git command?

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

Which objects in Git have a SHA1 hash?

  • Only Blobs and Trees
  • Each object in the database (Ans)
  • Each object in the database, and the same object can have multiple SHA1 hashes
  • Only Commits

Can an object in Git be safely modified?

  • No: if you changed even one bit, then you’d get a different object with its own SHA1. (Ans)
  • Yes: you can edit the content of the file that stores the object.
  • Yes: you can ask Git to generate a new SHA1 for the object.
  • No: you might get the same SHA1 as another object

Where does Git store the names of files and directories?

  • In the object database, inside the trees that point to the objects (Ans)
  • In the object database, inside the blobs and trees that store files and directories
  • Nowhere
  • In the “.git/links” subdirectory

What happens when you commit?

  • Both HEAD and the current branch change.
  • Neither HEAD nor the current branch change.
  • HEAD changes, the current branch doesn’t.
  • The current branch changes, HEAD doesn’t. (Ans)

Which objects are created when you merge?

  • Merges don’t create new objects.
  • Exactly one commit and nothing else
  • Zero or one commit and nothing else
  • Zero or one commit, and possibly new trees and blobs (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