Professional Documents
Culture Documents
Filtering:
--grep=”text”: show commits that have messages containing text. This is case sensitive.
-S”<change>”: show commit that has the specified change. Example: -S”OBJECTIVES” shows commits
with files containing the word OBJECTIVES.
git log <file name> or git log -- <file name>: show all commits that touch a specific file.
Formatting:
Aliases:
Checking out:
In detached mode, we should not make commit. Because new commit will be added on top of the
commit HEAD is pointing to, and when we exit detached mode, HEAD moves back to master. Therefore,
the new commit is not reachable by any commit -> dead commit and will be garbage collected -> we lost
that commit.
Bisecting:
Assuming the first commit is good and last is bad -> we are in detached mode, and HEAD points to the
commit in the middle of good and bad. Then we run automated test in first half: no issue -> issue in 2 nd
half, and vice versa. Repeat until end.
-n: number of commits made by author, -s: suppress message, -e: sow email
See all commits attached to that file and check out at the commit right before the commit to delete that
file.
git checkout hashid <filename> -> added file back to staging area.
Blaming:
-e: email
Tagging:
2 types of tag:
annotated tag: is a complete object with tagger name, email… -> git tag –a v1.0 –m <message>