1
I’m looking for a substring in the most recent commits from my repository.
I use the command git log -n1 --grep='${subString}'
.
But using the flag -n
I’m just gonna get the last commit, which is technically the most recent.
Ex:
commit 1a1a
Author: Gabriel Hardoim
Date: 2018-08-20 13:30:40
Esse commit tem a substring
But it can, and probably will, happen that there is more than one commit made recently, which makes the flag -n
inefficient.
Ex:
commit 2b2b
Author: Gabriel Hardoim
Date: 2018-08-20 13:40:02
Esse commit não tem
commit 1a1a //Nesse caso, esse é o commit que eu quero.
Author: Gabriel Hardoim
Date: 2018-08-20 13:30:40
Esse commit tem a substring
There are still the most common cases, where there are several commits with the substring that I’m looking for.
Ex:
commit 2b2b
Author: Gabriel Hardoim
Date: 2018-08-20 13:40:02
Esse commit não tem
commit 1a1a //Nesse caso, esse ainda é o commit que eu quero.
Author: Gabriel Hardoim
Date: 2018-08-20 13:30:40
Esse commit tem a substring
commit 3c3c
Author: Gabriel Hardoim
Date: 2018-08-20 13:20:11
Esse commit também tem a substring
commit 4d4d
Author: Gabriel Hardoim
Date: 2018-08-20 13:13:05
Esse commit também não tem
Whereas commits went to the remote repository by the same command git push
, what can I do to find a substring in the most recent commit message??
git log -1 -p ":/subString"
? I’m not sure I understand this very well, but git log allows you to fetch the last commit containing the message, in this casesubString
– Pedro