@@ -15,131 +15,131 @@ Review
1515Filter and sort
1616~~~~~~~~~~~~~~~
1717
18- .. glossary ::
18+ :samp: `$ git log [-n { COUNT } ] `
19+ lists the commit history of the current branch.
1920
20- :samp: ` $ git log [-n { COUNT } ] `
21- lists the commit history of the current branch .
21+ `` -n ` `
22+ limits the number of commits to the specified number .
2223
23- `` -n ` `
24- limits the number of commits to the specified number .
24+ :samp: ` $ git log [--after=" { YYYY-MM-DD } "] [--before=" { YYYY-MM-DD } "] `
25+ Commit history filtered by date .
2526
26- :samp: ` $ git log [--after=" { YYYY-MM-DD } "] [--before=" { YYYY-MM-DD } "] `
27- Commit history filtered by date .
27+ Relative specifications such as `` 1 week ago `` or `` yesterday `` are also
28+ permitted .
2829
29- Relative specifications such as `` 1 week ago `` or `` yesterday `` are also
30- permitted .
30+ :samp: ` $ git log --author=" { VEIT } " `
31+ filters the commit history by author .
3132
32- :samp: ` $ git log --author=" { VEIT } " `
33- filters the commit history by author.
33+ It is also possible to search for several authors at the same time, for
34+ example:
3435
35- It is also possible to search for several authors at the same time, for
36- example:
36+ :samp: `$ git log --author="{ VEIT\| VSC } " `
3737
38- :samp: `$ git log --author="{ VEIT\| VSC } " `
38+ :samp: `$ git log --grep="{ TERM } " [-i] `
39+ filters the commit history for regular expressions in the commit message.
3940
40- :samp: ` $ git log --grep=" { TERM } " [-i] `
41- filters the commit history for regular expressions in the commit message .
41+ `` -i ` `
42+ ignores upper and lower case .
4243
43- `` -i ` `
44- ignores upper and lower case .
44+ :samp: ` $ git log -S" { FOO } " [-i] `
45+ filters commits for specific lines in the source code .
4546
46- :samp: ` $ git log -S" { FOO } " [-i] `
47- filters commits for specific lines in the source code .
47+ `` -i ` `
48+ ignores upper and lower case .
4849
49- `` -i ` `
50- ignores upper and lower case .
50+ :samp: ` $ git log -G" { BA* } " `
51+ filters commits for regular expressions in the source code .
5152
52- :samp: `$ git log -G" { BA* } " `
53- filters commits for regular expressions in the source code .
53+ :samp: `$ git log -- { PATH } `
54+ filters the commit history for specific files .
5455
55- :samp: `$ git log -- { PATH } `
56- filters the commit history for specific files.
56+ :samp: `$ git log { MAIN } ..{ FEATURE } `
57+ filters for different commits in different branches, in our case between
58+ the :samp: `MAIN ` and :samp: `FEATURE ` branches.
5759
58- :samp: `$ git log { MAIN } ..{ FEATURE } `
59- filters for different commits in different branches, in our case between
60- the :samp: `MAIN ` and :samp: `FEATURE ` branches.
60+ However, this is not the same as :samp: `git log { FEATURE } ..{ MAIN } `. Let’s
61+ take the following example:
62+
63+ .. code-block ::
6164
62- However, this is not the same as :samp: `git log { FEATURE } ..{ MAIN } `. Let’s
63- take the following example:
65+ A - B main
66+ \
67+ C - D feature
6468
65- .. code-block ::
69+ :samp: `$ git log { MAIN } ..{ FEATURE } `
70+ shows changes in :samp: `{ FEATURE } ` that are not contained in
71+ :samp: `{ MAIN } `, that is, commits ``C `` and ``D ``.
72+ :samp: `$ git log { FEATURE } ..{ MAIN } `
73+ shows changes in :samp: `{ MAIN } ` that are not contained in
74+ :samp: `{ FEATURE } `, that is, commit ``B ``.
75+ :samp: `$ git log { MAIN } ...{ FEATURE } `
76+ shows the changes on both sides, that is, commits ``B ``, ``C `` and
77+ ``D ``.
6678
67- A - B main
68- \
69- C - D feature
79+ :samp: ` $ git log --follow { PATH/TO/FILE } `
80+ This ensures that the log shows changes to a single file, even if it has
81+ been renamed or moved.
7082
71- :samp: `$ git log { MAIN } ..{ FEATURE } `
72- shows changes in :samp: `{ FEATURE } ` that are not contained in
73- :samp: `{ MAIN } `, that is, commits ``C `` and ``D ``.
74- :samp: `$ git log { FEATURE } ..{ MAIN } `
75- shows changes in :samp: `{ MAIN } ` that are not contained in
76- :samp: `{ FEATURE } `, that is, commit ``B ``.
77- :samp: `$ git log { MAIN } ...{ FEATURE } `
78- shows the changes on both sides, that is, commits ``B ``, ``C `` and
79- ``D ``.
83+ You can activate ``--follow `` for individual file calls by default by
84+ activating the ``log.follow `` option in your global configuration:
8085
81- :samp: `$ git log --follow { PATH/TO/FILE } `
82- This ensures that the log shows changes to a single file, even if it has
83- been renamed or moved.
86+ .. code-block :: console
8487
85- You can activate ``--follow `` for individual file calls by default by
86- activating the ``log.follow `` option in your global configuration:
88+ $ git config --global log.follow true
8789
88- .. code-block :: console
90+ Then you no longer have to enter `` --follow ``, but only the file name.
8991
90- $ git config --global log.follow true
92+ ``$ git log -L ``
93+ With the `-L
94+ <https://git-scm.com/docs/git-log#Documentation/git-log.txt--Lltstartgtltendgtltfilegt> `_
95+ option, you can perform a refined search by checking the log of only part
96+ of a file:
9197
92- Then you no longer have to enter ``--follow ``, but only the file name.
98+ * :samp: `$ git log -L { LINE_START_INT|LINE_START_REGEX } ,{ LINE_END_INT|LINE_END_REGEX } :{ PATH/TO/FILE } `
99+ * :samp: `$ git log -L :{ FUNCNAME_REGEX } :{ PATH/TO/FILE } `
93100
94- :samp: `$ git log -L { LINE_START_INT|LINE_START_REGEX } ,{ LINE_END_INT|LINE_END_REGEX } :{ PATH/TO/FILE } `
95- :samp: `$ git log -L :{ FUNCNAME_REGEX } :{ PATH/TO/FILE } `
96- With the `-L
97- <https://git-scm.com/docs/git-log#Documentation/git-log.txt--Lltstartgtltendgtltfilegt> `_
98- option, you can perform a refined search by checking the log of only part
99- of a file. This function allows you to thoroughly search through the
100- history of a single function, class or other code block. It is ideal for
101- finding out when something was created and how it was changed so that you
102- can correct, refactor or delete it with confidence.
101+ This function allows you to thoroughly search through the history of a single
102+ function, class or other code block. It is ideal for finding out when
103+ something was created and how it was changed so that you can correct,
104+ refactor or delete it with confidence.
103105
104- For more comprehensive investigations, you can also track multiple
105- blocks. You can use multiple ``-L `` options at once.
106+ For more comprehensive investigations, you can also track multiple blocks.
107+ You can use multiple ``-L `` options at once.
106108
107- :samp: `$ git log --reverse `
108- The log usually displays the latest commit first. You can reverse this
109- with ``--reverse ``. This is particularly useful if you are analysing with
110- the ``-S `` and ``-G `` options already mentioned. By reversing the order
111- of the commits, you can quickly find the first commit that added a
112- specific string to the codebase.
109+ :samp: `$ git log --reverse `
110+ The log usually displays the latest commit first. You can reverse this
111+ with ``--reverse ``. This is particularly useful if you are analysing with
112+ the ``-S `` and ``-G `` options already mentioned. By reversing the order
113+ of the commits, you can quickly find the first commit that added a
114+ specific string to the codebase.
113115
114116View
115117~~~~
116118
117- .. glossary ::
118-
119- :samp: `$ git log --stat --patch|-p `
120- ``--stat ``
121- A summary of the number of changed lines per file is added to the
122- usual metadata.
123- ``--patch|-p ``
124- adds the complete commit diff to the output.
125-
126- :samp: `$ git log --oneline --decorate --graph --all|{ FEATURE } `
127- display the history graph with references, one commit per line.
128-
129- ``--oneline ``
130- One commit per line.
131- ``--decorate ``
132- The prefixes ``refs/heads/ ``, ``refs/tags/ `` and ``refs/remotes/ ``
133- are not output.
134- ``--graph ``
135- The log usually smoothes historical branches and displays commits one
136- after the other. This hides the parallel structure of the history
137- when merging branches. ``--graph `` displays the history of the
138- branches in ASCII format.
139-
140- :samp: `--all|{ FEATURE } `
141- ``--all `` shows the log for all branches; :samp: `{ FEATURE } ` only
142- shows the commits of this branch.
119+ :samp: `$ git log --stat --patch|-p `
120+ ``--stat ``
121+ A summary of the number of changed lines per file is added to the
122+ usual metadata.
123+ ``--patch|-p ``
124+ adds the complete commit diff to the output.
125+
126+ :samp: `$ git log --oneline --decorate --graph --all|{ FEATURE } `
127+ display the history graph with references, one commit per line.
128+
129+ ``--oneline ``
130+ One commit per line.
131+ ``--decorate ``
132+ The prefixes ``refs/heads/ ``, ``refs/tags/ `` and ``refs/remotes/ ``
133+ are not output.
134+ ``--graph ``
135+ The log usually smoothes historical branches and displays commits one
136+ after the other. This hides the parallel structure of the history
137+ when merging branches. ``--graph `` displays the history of the
138+ branches in ASCII format.
139+
140+ :samp: `--all|{ FEATURE } `
141+ ``--all `` shows the log for all branches; :samp: `{ FEATURE } ` only
142+ shows the commits of this branch.
143143
144144.. _reflog :
145145
@@ -162,13 +162,11 @@ Let’s look at the basics of using reflog and some typical use cases.
162162Show the reflog for ``HEAD ``
163163~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164164
165- .. glossary ::
166-
167- :samp: `$ git reflog `
168- If no options are specified, the command displays the reflog for ``HEAD ``
169- by default. It is short for ``git reflog show HEAD ``. git reflog has
170- other subcommands to manage the log, but show is the default command if
171- no subcommand is passed.
165+ :samp: `$ git reflog `
166+ If no options are specified, the command displays the reflog for ``HEAD `` by
167+ default. It is short for ``git reflog show HEAD ``. git reflog has other
168+ subcommands to manage the log, but show is the default command if no
169+ subcommand is passed.
172170
173171.. code-block :: console
174172 :linenos:
0 commit comments