Git Flashcards
What is a branch?
Separate version of the main repository
How to create a branch?
git branch branchName
How to move to a branch?
git checkout branchName
What option, when moving to a branch, creates one if it doesn’t exist?
-b
What is the command to marge the current branch with a specified branch?
git merge branchName
How to delete a branch?
git branch -d branchName
What is the command to get the change history of a remote repository?
git fetch repoName
What is the command to show the differences between the current branch and a specified branch?
git diff branchName
git pull is a combination of?
fetch and merge
What is the difference between a branch and a tag?
A branch is a movable label placed on a commit, but a tag is a fixed label placed on a commit
Reset vs Hard reset
Reset unstages files from the index; Hard reset modifies the index and resets files in the working area
How does a detached head state occur?
If you check out a revision that has no branch label
What is cherry-picking?
Manually selecting diffs from one branch to be applied to another
What does git bisect do?
Uses a binary search algorithm to find which commit introduced a bug