git snipets - ghdrako/doc_snipets GitHub Wiki
At least two occasions where creating an empty commit can make quite a bit of sense:
- Initializing new repositories.
- Triggering continuous deployment pipelines.
git commit --allow-empty -m "Initial commit"
git log -1 --format=%s
git show -s --format=%s
git show-branch --no-name HEAD # work much faster then above command !!!
time git show-branch --no-name HEAD # show execution time
Flags:
- The
-1in git log -n command refers to the latest commit. - The
-sflag (or--no-patch) is optional. However, it is specified here to suppress the diff output — which is shown by the git show command by default in addition to the full commit details.
- The
%sin--format=<format>option refers to the "subject" line of the commit output. - the
%hformat modifier to also output the short hash of the commit (or%Hfor the full hash)
git log --grep="Updated"
git log --grep="Updated" -i # case sensitice
git log --grep="Updated" --grep="readme" # logical or commit message matches at least one of the given patterns
git log --grep="Updated" --grep="readme" --all-match # logical and
Flags
-
-iflag (or--regexp-ignore-case)