Version Control using Git Flashcards
What is Version Control?
A system that tracks changes to files over time.
List the benefits of using Version Control.
- Enforce discipline
- Archive versions
- Maintain historical information
- Enable collaboration
- Recover from accidental deletions or edits
- Conserve disk space
What is Git?
A version control system that lets you track changes to files over time.
What is the goal of Version Control?
Reproducibility and traceability.
What is GitHub?
A cloud-based platform for storing files and providing version control powered by Git.
What is a Git repository?
A directory where all files for a project are stored, including revisions and history.
Define commits in Git.
Every change or set of changes finalized in Git, identified by a unique ID (SHA-1 hash).
What is the staging area in Git?
A draft space where changes are prepared before committing.
What is the default branch in Git?
Master.
What does merging in Git do?
Combines changes from a branch back into the master branch or another branch.
What are remote repositories in Git?
Repositories that can be accessed and worked on remotely, often hosted on platforms like GitHub.
What does the ‘push’ command do in Git?
Uploads local changes to a remote repository.
What is the purpose of the ‘pull’ command in Git?
Updates the local repository with changes from a remote repository.
What is the difference between ‘fetch’ and ‘pull’ in Git?
‘Fetch’ retrieves updates without merging them; ‘pull’ retrieves and merges.
What does the ‘clone’ command do in Git?
Creates a copy of an existing Git repository, including its files and history.
What is conflict resolution in Git?
The process of manually resolving conflicts when multiple contributors modify the same code.
What does the ‘git log’ command do?
Displays the history of commits, their unique IDs, and associated messages.
Fill in the blank: A Git repository is initiated in a directory using the command _______.
git init
What are the three trees maintained by Git in a local repository?
- Working Directory - Holds the actual version of the files
- Index - Acts as staging area, move files using git add command
- Local Repository - Using git commit command, updates the repository’s “head” which points to the last commit we made
What command is used to move files into the staging area in Git?
git add
What is the purpose of the ‘git commit’ command?
To save changes into the Local Repository and update the repository’s ‘head’.
What is the role of Git in the DevOps life cycle?
Facilitates version control for source code, scripts, configuration information, and libraries.
True or False: Git is only useful for developers.
False.
What is a feature flag in the context of DevOps?
A technique to enable or disable features in a production environment without deploying new code.