git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global core.editor nano
git config --global init.defaultBranch main
# For Linux or macOS:
git config --global core.autocrlf input
# For Windows:
git config --global core.autocrlf true
# If you're behind a corporate proxy on Windows
git config --global http.sslBackend schannel
blog
repository:git log
git blame
git bisect
git log
git log
to list commitsgit log
can be customised with
optionsgit log --help
lists the available options
git log --stat --author "Guido"
--stat
counts lines changed in each file
git log --stat --follow -- README.rst
--follow
includes commits made when the file had
another name (Git can follow most renames)--
tells Git that what comes next is a filegit log --grep "gh-123458:"
--grep
searches commit messages - so make them useful!
parse_entry
removed?git log --patch -S "parse_entry"
-S
searches the contents of lines changed
--patch
shows the diff of each commitAnswer very specific questions like:
Didn’t Ben make an important change to
login.html
the week before we went on holiday?
git log \
--author Ben \
--since 2023-12-18 \
--until 2023-12-22 \
-- login.html
git blame -- README.rst
git show 914476
to see the contents of a
commit-w
-M
) or whole repo
(-C
)git bisect start bad1 g00d
git bisect good
git bisect bad
git bisect bad
git bisect reset
git bisect skip
git diff
, git blame
, Git pickaxe,
etc.RichardLitt
?