What does the git archive command do?

What does the git archive command do?

a) Creates a zip or tar archive of the repository
b) Archives old commits
c) Deletes branches
d) Shows archived commits

Answer:

a) Creates a zip or tar archive of the repository

Explanation:

The git archive command is used to create an archive (zip, tar, etc.) of the contents of a Git repository. It doesn’t include the Git metadata but packages the working directory files at a particular point in time.

This is useful for generating distribution-ready archives of a specific version of the project without including the entire repository history.

You can also use git archive to export a particular branch or tag.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top