What is the difference between git reset and git revert?

  • git reset removes commits
  • git reset undoes changes in the working directory
  • git revert removes commits
  • git revert undoes changes in the working directory
The correct option is git revert. Unlike git reset, which removes commits from the branch history, git revert creates a new commit that undoes the changes introduced by a specific commit. This ensures a safer and non-destructive way to undo changes. git reset, on the other hand, can be used to move the branch pointer and potentially discard commits.

What is a 'fast-forward' merge in Git?

  • Merging without creating a new commit
  • Merging with conflicts
  • Merging with rebase
  • Merging with a new commit
A 'fast-forward' merge occurs when the target branch has no new commits since the source branch was created. In this case, Git simply moves the pointer of the target branch to the latest commit of the source branch without creating a new commit.

For large enterprises, Git's ability to handle ________ is crucial for maintaining a smooth workflow.

  • Distributed Version Control Systems (DVCS)
  • Large Repositories
  • Merge Conflicts
  • Branching Strategies
In large enterprises, Git's capacity to efficiently manage and process large repositories is essential. This involves handling extensive codebases, managing numerous branches, and ensuring seamless collaboration among multiple teams. A robust version control system capable of scaling with the size of the projects is crucial for maintaining a smooth workflow in such environments.

What lesson is typically learned from major Git failures in terms of repository management?

  • Frequent Backups are Unnecessary
  • Centralized Version Control is Superior
  • Branches Should be Avoided
  • Robust Backup and Recovery Practices are Crucial
Major Git failures emphasize the importance of robust backup and recovery practices. Having reliable backups ensures that in case of failures, the repository can be restored, preventing significant data loss.

What is a common Git workflow used in managing open source projects?

  • Centralized Workflow
  • Feature Branch Workflow
  • Gitflow Workflow
  • Forking Workflow
In open source projects, the Forking Workflow is commonly used. Contributors fork the main repository, create a branch for their changes, and then submit a pull request. This allows for a decentralized collaboration model.

How does the Git Large File Storage (LFS) handle binary files differently from standard Git?

  • LFS stores binary files in a separate server
  • LFS stores pointers to large files instead of the files themselves
  • LFS compresses binary files before storing
  • LFS converts binary files to text before storage
Git LFS doesn't store the actual binary files in the repository; instead, it stores pointers to them. This helps manage large files more efficiently without bloating the Git repository.

The command git reset ______ is used to reset the current HEAD to the specified state.

  • hard
  • soft
  • mixed
  • revert
The correct option is hard. The git reset --hard command resets the current branch and working directory to the specified commit. This option discards all changes, so use it with caution.

To prevent accidental commits of confidential data, Git can use a pre-commit ________.

  • hooks
  • filters
  • validations
  • scripts
In Git, pre-commit hooks allow you to perform actions or checks before a commit is completed. They are often used to prevent committing sensitive data, making "hooks" the correct term in this context.

How does Git track changes within a repository?

  • Through file timestamps
  • By creating snapshots of the changes
  • Using file checksums for changes
  • Tracking changes through external logs
Git tracks changes by creating snapshots of the entire repository at different points in time. Each snapshot (commit) contains a reference to the previous snapshot, forming a chain of changes.

In a collaborative environment, a developer wants to contribute to a project they don't have write access to. What Git workflow should they follow?

  • Feature Branch Workflow
  • Gitflow Workflow
  • Forking Workflow
  • Centralized Workflow
The Forking Workflow is suitable for situations where a developer wants to contribute to a project without having direct write access. They fork the repository, create a feature branch in their fork, and then submit a pull request for the changes to be merged into the main project.