Git Flashcards
Use git f____ to retrieve new work done by other people
Use git fetch to retrieve new work done by other people
command you use to view the changes in the files you are going to commit
git diff
view the changes in the staging area
git diff –cached
If you seem to have lost your history, check the r____ as your safety net.
If you seem to have lost your history, check the reflog as your safety net.
git reflog
To search the commit log for a text pattern:
git log –grep=”text here”
git log –grep=word
output git log with the first line only
git log –oneline
view the changes in all previous commits
git log -p
discard all changes you made in the working tree
git restore .
To unstage all files from the current change set:
git reset
The major benefit of rebasing (over merging) is that you get a much cleaner project h_____
The major benefit of rebasing is that you get a much cleaner project history
The golden rule of git rebase is to never use it on p____ branches.
The golden rule of git rebase is to never use it on public branches.
So, before you run git rebase, always ask yourself, “Is anyone else looking at this branch?” If the answer is yes, take your hands off the keyboard and start thinking about a non-destructive way to make your changes (e.g., the git r____ command).
So, before you run git rebase, always ask yourself, “Is anyone else looking at this branch?” If the answer is yes, take your hands off the keyboard and start thinking about a non-destructive way to make your changes (e.g., the git revert command).
If you would prefer a clean, linear history free of unnecessary merge commits, you should reach for git r____ instead of git merge when integrating changes from another branch.
If you would prefer a clean, linear history free of unnecessary merge commits, you should reach for git rebase instead of git merge when integrating changes from another branch.
The git s___ command takes your uncommitted changes (both staged and unstaged), saves them away for later use, and then reverts them from your working copy
The git stash command takes your uncommitted changes (both staged and unstaged), saves them away for later use, and then reverts them from your working copy
You can reapply previously stashed changes with git s____ p__
You can reapply previously stashed changes with git stash pop
If you decide you no longer need a particular stash, you can delete it with git stash d___
If you decide you no longer need a particular stash, you can delete it with git stash drop
git b____ is used to examine specific points of a file’s history and get context as to who the last author was that modified the line.
git blame is used to examine specific points of a file’s history and get context as to who the last author was that modified the line.
The -_ option will perform a “dry run” of git clean. This will show you which files are going to be removed without actually removing them.
The -n option will perform a “dry run” of git clean. This will show you which files are going to be removed without actually removing them.
$ git clean -n Would remove untracked_file
The git revert command can be considered an ‘undo’ type command, however, it is not a traditional undo operation. Instead of removing the commit from the project history, it figures out how to invert the changes introduced by the commit and appends a new commit with the resulting inverse content. This prevents Git from losing h____, which is important for the integrity of your revision history and for reliable collaboration.
The git revert command can be considered an ‘undo’ type command, however, it is not a traditional undo operation. Instead of removing the commit from the project history, it figures out how to invert the changes introduced by the commit and appends a new commit with the resulting inverse content. This prevents Git from losing history, which is important for the integrity of your revision history and for reliable collaboration.
Reverting should be used when you want to apply the i_____ of a commit from your project history. This can be useful, for example, if you’re tracking down a bug and find that it was introduced by a s____ commit. Instead of manually going in, fixing it, and committing a new snapshot, you can use git revert to automatically do all of this for you.
Reverting should be used when you want to apply the inverse of a commit from your project history. This can be useful, for example, if you’re tracking down a bug and find that it was introduced by a single commit. Instead of manually going in, fixing it, and committing a new snapshot, you can use git revert to automatically do all of this for you.
Other ‘undo’ commands like, git checkout and git reset, move the H___ and branch ref pointers to a specified commit. Git revert also takes a specified commit, however, git revert does not move ref p_____ to this commit.
Other ‘undo’ commands like, git checkout and git reset, move the HEAD and branch ref pointers to a specified commit. Git revert also takes a specified commit, however, git revert does not move ref pointers to this commit.
git revert is able to target an individual commit at an arbitrary point in the h____, whereas git reset can only work backward from the c____ commit.
git revert is able to target an individual commit at an arbitrary point in the history, whereas git reset can only work backward from the current commit.
The git r____ command is a complex and versatile tool for undoing changes with three primary forms of invocation that correspond to command line arguments: –soft, –mixed, –hard
The git reset command is a complex and versatile tool for undoing changes with three primary forms of invocation that correspond to command line arguments: –soft, –mixed, –hard
The three git reset arguments each (–soft, –mixed, –hard) correspond to Git’s three internal state management mechanism’s, The Commit Tree (HEAD), The Staging Index, and The Working Directory.
The three git reset arguments each (–soft, –mixed, –hard) correspond to Git’s three internal state management mechanism’s, The Commit Tree (HEAD), The Staging Index, and The Working Directory.
git reset moves both the H____ and branch r___s to the specified commit.
git reset moves both the HEAD and branch refs to the specified commit.
The default invocation of git reset has implicit arguments of –m____ and HEAD
The default invocation of git reset has implicit arguments of –mixed and HEAD
Rebase itself has 2 main modes: “m____” and “i_____” mode
Rebase itself has 2 main modes: “manual” and “interactive” mode
From a content perspective, rebasing is changing the base of your branch from one commit to another making it appear as if you’d created your branch from a different c_____.
From a content perspective, rebasing is changing the base of your branch from one commit to another making it appear as if you’d created your branch from a different commit.
The git checkout command accepts a -__ argument that acts as a convenience method which will create the new branch and immediately switch to it.
The git checkout command accepts a -b argument that acts as a convenience method which will create the new branch and immediately switch to it.
git checkout -b <new-branch>
Passing the –m___ argument to the git log command will produce a log with a list of commits that conflict between the merging branches.
Passing the –merge argument to the git log command will produce a log with a list of commits that conflict between the merging branches.
Executing git merge with the –a___ option will exit from the merge process and return the branch to the state before the merge began.
Executing git merge with the –abort option will exit from the merge process and return the branch to the state before the merge began.
The git merge and git pull commands can be passed an -_ (strategy) option. The -_ option can be appended with the name of the desired merge strategy.
The git merge and git pull commands can be passed an -s (strategy) option. The -s option can be appended with the name of the desired merge strategy.
The –g____ option draws an ASCII graph representing the branch structure of the commit history.
The –graph option draws an ASCII graph representing the branch structure of the commit history.
see all config variables
git config -list