When you run git branch <branch>, Git runs that update-ref command to add the SHA-1 of the last commit of the branch you're on into whatever new reference you want to create.
Back
rebase [<upstream> [<branch>]]
Front
Command that reapplies commits on top of another base tip.
<branch> is the current branch.
<upstream> is the current branch's upstream.
All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area.
The current branch is reset to <upstream>. This has the exact same effect as git reset --hard <upstream>
The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order.
When rebase exits, <branch> is the current branch.
Back
cat-file -p
Front
Command and flag to view a Git blob — first figure out the type of content, then display it appropriately:
Back
config
Front
File containing project-specific configuration options like repositoryformatversion, filemode, bare, logallrefupdates, symlinks, and ignorecase
Back
update-index
Front
Plumbing command to add information to the staging area
Back
git log -- until, git log --before
Front
Git log command to limit the commits to those made before the specified date.
Back
What is an annotated tag?
Front
Back
git log -S
Front
The git log -S option (colloquially referred to as Git's "pickaxe" option) takes a string and shows only those commits that changed the number of occurrences of that string.
For instance, if you wanted to find the last commit that added or removed a reference to a specific function, you could call:
$ git log -S function_name
Back
In GitFlow, what are the rules for a release branch?
Front
May branch off from: develop
Must merge back into: develop and master
Branch naming convention:
release-*
Back
cat-file
Front
Command to inspect a Git object's contents
Back
commit-tree
Front
Plumbing command to make a commit object from a tree and a message.
Back
info
Front
Directory that contains the 'exclude' file
Back
What is a branch?
Front
A simple pointer or reference to the head of a line of work.
Back
refs
Front
Directory that stores pointers into the commit objects in the Git database (branches, tags, remotes, and more.)
Back
In GitFlow, what is the develop branch used for?
Front
"We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the 'integration branch'. This is where any automatic nightly builds are built from."
Back
What is a ref?
Front
A ref (also: "reference") is a file that matches a SHA-1 value to a simple name.
Back
What does a Git object header contain?
Front
The type of object ("blob", "tree", "commit") followed by a space, the size in bytes of the content, and a final null byte.
Back
In GitFlow, how are emergency fixes to production handled?
Front
Hotfix branches are used to create emergency fixes. They are branched directly from a tagged release in the master branch, and when finished are merged back into both master and develop.
Back
HEAD
Front
File that points to the branch you currently have checked out
Back
In GitFlow, what are the rules for release branches?
Front
May branch off from: develop
Must merge back into: develop
Branch naming convention: anything except master, develop, release-, or hotfix-
Back
objects
Front
Directory that contains all the content for Git's database
Back
read-tree
Front
Plumbing command that reads a tree into the index
Back
write-tree
Front
Plumbing command to write the staging area into a tree object
Back
hooks
Front
Directory that contains your client-or server-side hook scripts.
Back
fetch
Front
Command to fetch branches and/or tags (collectively, "refs") from one or more other repositories, along with the objects necessary to complete their histories.
Back
In GitFlow, what are the rules for a hotfix branch?
Front
May branch off from: master
Must merge back into: develop and master
Branch naming convention:
hotfix-*
When a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop.
Back
What does git commit do?
Front
git commit creates the commit object, specifying the parent of that commit object to be whatever SHA-1 value the reference in HEAD points to.
Back
git log —committer
Front
Git log option to only show commits in which the committer entry matches the specified string.
Back
update-refs
Front
Plumbing command to update a ref:
$ git update-ref refs/heads/master 1a410efbd13591db07496601ebc7a059dd55cfe9
Back
A Binary Large OBject (BLOB) is a collection of binary data stored as a single entity in a database management system
Front
What is a blob, in Git?
Back
cat-file -t
Front
Command to have Git tell you the object type of any object in Git, given its SHA-1 key.
Back
In GitFlow, what is the parent branch for a release?
Front
When it is time to make a release, a release branch is created off of develop.
Back
What is a tag?
Front
The tag object is very much like a commit object — it contains a tagger, a date, a message, and a pointer. The main difference is that a tag object generally points to a commit rather than a tree.
Back
description
Front
File used by the GitWeb program to describe the repository
Back
Command to prepare content for insertion into the object database
Front
hash-object
Back
exclude
Front
File that contains patterns to exclude that you don't want in .gitignore
Back
index
Front
File that stores staging area information
Back
In GitFlow, where are feature branches branches branched from and merged to?
Front
In GitFlow, feature branches are branched off of the develop branch. Finished features are merged back into the develop branch when they're ready for release:
Back
In GitFlow, what happens at release time?
Front
develop is merged into master.
master is tagged with a release number.
Back
SHA-1
Front
In cryptography, SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function which takes an input and produces a 160-bit (20-byte) hash value known as a message digest - typically rendered as a hexadecimal number, 40 digits long. It was designed by the United States National Security Agency, and is a U.S. Federal Information Processing Standard.
Back
--no-ff
Front
Option for git-merge that causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward.
Back
master^{tree}
Front
Syntax to specify the tree object that is pointed to by the last commit on your master branch.
Back
status
Front
Command that displays:
1) Paths that have differences between the index file and the current HEAD commit — what you would commit by running for commit
2) Paths that have differences between the working tree and the index file. These are changes that you could commit by running git add, then git commit.
3) Paths in the working tree that are not tracked by Git (and are not ignored by gitignore.) These are paths that you could add and commit.
Back
symbolic-ref
Front
Command to read or update the target of the HEAD file:
$ git symbolic-ref HEAD refs/heads/test
Back
What is the HEAD file?
Front
The HEAD file is a symbolic reference to the branch you're currently on. It doesn't generally contain a SHA-1 value but rather a pointer to another reference.
$ cat .git/HEAD
ref: refs/heads/master
Back
In GitFlow, what is done with the release branch once it's been tested?
Front
The release branch is merged into master and into develop too, to make sure that any changes made in the release branch aren't accidentally lost by new development.
Back
git log --since, git log --after
Front
Git log option to limit the commits to those made after the specified date.
Back
In GitFlow, what is the master branch used for?
Front
The master branch tracks released code only. The only commits to master are merges from release branches and hotfix branches.
"We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state."
Back
What is a lightweight tag?
Front
A lightweight tag is a reference that never moves
Back
git log -- author
Front
Git log option to only show commits in which the author entry matches the specified string.
Back
Section 2
(5 cards)
git rerere
Front
Short for "reuse recorded resolution".
As the name implies, it allows you to ask Git to remember how you've resolved a hunk conflict so that the next time it sees the same conflict, Git can resolve it for you automatically.
Enabled with
$ git config --global rerere.enabled true
Source: Pro Git loc 5423
Back
git log —grep
Front
Git log option to only show commits with a commit message containing the string
Back
git commit --amend
Front
Git commit option to replace the tip of the current branch by creating a new commit.
The recorded tree is prepared as usual, and the message from the original commit is used as the starting point, instead of an empty message.
The new commit has the same parents and author as the current one.
Back
git log -<n>
Front
Git log command to show only the last _n_ commits
Back
git log --no-merges
Front
Git log option to prevent the display of merge commits