What Git command would you use to discard changes in a specific file before it has been staged?
- git checkout -- filename
- git reset HEAD filename
- git restore filename
- git revert filename
The correct option, git checkout -- filename, discards changes in a specific file before staging. It reverts the file to the last committed state. git reset HEAD filename unstages changes, git restore filename is used after staging, and git revert filename is for creating a new commit to undo changes.
In what way does integrating Git with an IDE assist in resolving merge conflicts?
- Visual Conflict Resolution
- Automated Conflict Resolution
- Conflict Ignoring
- Merge Conflict Alerts
Integrating Git with an Integrated Development Environment (IDE) provides visual tools for conflict resolution. Developers can easily view and resolve conflicts, making the process more intuitive and efficient.
What advanced technique can be used in Git to combine multiple commit histories into a single unified history?
- Git rebase
- Git merge
- Git cherry-pick
- Git reset
The advanced technique in Git to combine multiple commit histories into a single unified history is 'Git rebase.' It allows you to reapply commits on top of another branch, resulting in a cleaner and more linear commit history. This can be useful in creating a streamlined and comprehensible project history.
A company is transitioning from SVN to Git. They want to ensure their historical branches and tags are preserved. What migration strategy should they use?
- Fast-Forward Merge
- Rebase
- Submodule
- git-svn
The git-svn option allows for a smooth transition from SVN to Git, preserving historical branches and tags. It maintains compatibility during migration.
A team is transitioning a large legacy codebase to Git. They encounter issues with large binary files. What Git feature should they consider using?
- Git LFS
- Git submodules
- Git cherry-pick
- Git rebase
Large binary files can be efficiently managed using Git LFS (Large File Storage). Git LFS is an extension that replaces large files in a repository with tiny pointer files while storing the actual file contents on a separate server. This helps in handling binary files more effectively.