How do you resolve a merge conflict in Git?
- git merge --abort
- git resolve
- git commit -m "Merge Conflict"
- git merge --continue
When a merge conflict occurs in Git, the correct option is to use git merge --abort to abort the merge process and return to the pre-merge state. This option discards the current merge and lets you start over.
To handle complex project structures in Git, large projects often rely on ________ to manage different components.
- Branching
- Submodules
- Merging
- Tags
In Git, submodules are used to manage different components of a project. Submodules allow you to include other Git repositories as a subdirectory, enabling better organization of complex project structures.
The __________ Git Hook is executed on the client side before a push is executed.
- pre-receive
- post-receive
- pre-push
- post-commit
The correct answer is pre-push. This Git hook is triggered on the client side just before a push is executed. It allows you to check certain conditions before allowing the push operation. Common use cases include running tests or code style checks before changes are pushed to the remote repository.
To enhance security, sensitive data in a Git repository should be stored in an encrypted ________.
- Blob
- Object
- File
- Repository
Storing sensitive data in an encrypted object ensures that unauthorized users cannot access or view the confidential information, adding an extra layer of security to the Git repository.
What does the git log command display in a Git repository?
- List of all branches.
- Commit history with detailed information.
- Uncommitted changes in the working directory.
- Status of files in the staging area.
The git log command displays the commit history of the repository. It includes information such as the commit hash, author, date, and commit message. This helps in tracking changes, understanding the project's development timeline, and identifying specific commits for reference or debugging purposes.
A developer frequently uses long and complex Git commands. Which feature of Git can they use to create shortcuts for these commands?
- Git Alias
- Git Tag
- Git Remote
- Git Branch
Git Alias is a feature that allows developers to create shortcuts for long and complex Git commands, enhancing efficiency and reducing the likelihood of errors in command execution.
In Git, _______ can be used to temporarily switch to another branch without committing the current work.
- git checkout
- git merge
- git branch
- git stash
In Git, the command 'git checkout' is used to switch between branches. It allows you to navigate between different branches without committing your current changes.
What impact does Git have on continuous integration and continuous deployment in Agile teams?
- Improved collaboration and parallel development
- Faster integration and deployment pipelines
- Better tracking of changes and versioning
- Increased code conflicts
Git positively impacts continuous integration and continuous deployment in Agile teams by enabling faster integration and deployment pipelines, improving collaboration through parallel development, and ensuring better tracking of changes and versioning.
In a case study of a successful enterprise, what Git practice was found to be key in managing their large-scale projects efficiently?
- Git Flow Workflow
- Forking Workflow
- Feature Branch Workflow
- Centralized Workflow
The Feature Branch Workflow was found to be key in managing large-scale projects efficiently. It involves creating separate branches for each feature, allowing parallel development without affecting the main codebase until features are thoroughly tested and ready for integration.
How does the git reflog command assist in recovering lost commits?
- Lists all remote branches
- Shows a log of changes to branch references
- Deletes the commit history
- Resets the working directory
The git reflog command displays a log of changes to branch references, including commits that may not be part of the current branch. It's useful for recovering lost commits or undoing changes.