Git Flashcards
What is version control? What makes git different from other version control software?
A distributed version control system involves cloning a Git repository. Version control enables teams to collaborate and streamline development to resolve conflicts and create a centralized location for code.
List the git commands you know and what they do
git add. Adds files
git commit. Commits files
git checkout. Checks out to a branch
git push. Pushes files to git repository
How would you prevent a file from being tracked by git?
using the git rm command with the –cached option.
What is a branch? What are some common branching strategies?
A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process.
Git Flow is the most widely known branching strategy that takes a multi-branch approach to manage the source code. This approach consists of two main branches that live throughout the development lifecycle.
What is a merge conflict? How do you prevent these and resolve if it happens?
You can resolve merge conflicts using the command line and a text editor. Merge conflicts occur when competing changes are made to the same line of a file, or when one person edits a file and another person deletes the same file.
What is a GitHub pull request?
Pull requests let you tell others about changes you’ve pushed to a branch in a repository on GitHub.
What is the git workflow for editing code and saving changes?
The primary way to save your changes is to add them to Git’s staging area using the git add command and then commit using git commit. This saves your revision information in Git’s repository which makes it a part of your commit history.
What is a commit?
Commits are the core building block units of a Git project timeline. Commits can be thought of as snapshots or milestones along the timeline of a Git project. Commits are created with the git commit command to capture the state of a project at that point in time.
How would you go back in your commit history if you make a mistake?
use git log to get a list of previous commits. use git checkout and the id to revert to a previous commit.