git logã®ãªãã·ã§ã³ïŒäžç·šïŒ
ååã®èšäºã§ãäžã
ã®æ°ã®git log
ã®ãªãã·ã§ã³ã玹ä»ããŸãããããŸã ãŸã ç¶ããŸãã
ååã¯ã³ãããã«ã€ããŠãã©ããã£ãå
容ãåºåãããããéžæãããããªãªãã·ã§ã³ã玹ä»ããŸããã察ããŠä»åã¯ããã©ã®ã³ããããåºåãããããšãããã³ããããçµããããªãªãã·ã§ã³ã玹ä»ããŸããäŸãã°ãã2020幎ã®ã³ãããã ããåºåããããindex.html
ãå€æŽããã³ãããã ããåºåããããšãã£ãå
·åã§ãã
ãªããžããªãŒã®åçŸ
ååäœæãããªããžããªãŒãåŒãç¶ã䜿çšããŸãã以äžã®å 容ãå®è¡ããããšã§ããªããžããªãŒãåçŸããããšãã§ããŸãã
ã¹ã¯ãªãããèŠã
# index.htmlãäœæ
touch index.html
git add .
git commit -m "Create index.html"
# index.htmlãç·šé
echo -e "aaa\nbbb\nccc" >> index.html
git add .
git commit -m "Edit index.html"
# style.cssãäœæ
touch style.css
git add .
git commit -m "Create style.css"
# index.htmlãç·šé
echo -e "aaaaaa\nbbb" > index.html
git add .
git commit -m "2nd Edit index.html"
# index.htmlãejsãã¡ã€ã«ã«å€æŽ
git mv index.html index.ejs
git commit -m "Rename index.html"
# index.ejsãåé€
git rm index.ejs
git commit -m "Remove index.ejs"
-n <number>
ã§ã³ãããæ°ãçµã
-n
ãªãã·ã§ã³ã§ãåºåãããã³ãããæ°ãæå®ããããšãã§ããŸããäŸãã°-n 1
ãªã1ã³ãããã-n 10
ãªã10ã³ãããåºåãããŸãããããã¯ã-10
ã®ããã«-
ã«ç¶ããŠæ°å€ãæã£ãŠãæ§ããŸããã
$ git log -n 2 --oneline
8359ebb (HEAD -> master, style.css) Remove index.ejs
ae45f13 Rename index.html
ãšããããçŽè¿ã®ã³ãããã確èªãããæã«git log
ãšæã£ãŠäœçŸãšã³ããããåºåããããšãã£ãšãããã®ã§ãç§ã¯ãšã€ãªã¢ã¹ã§æåããã³ãããæ°äžéã10ã«æå®ããŠããŸãã
[alias]
# ã³ãããæ°ãããã©ã«ãã§10ã«å¶é
lol = log --all --graph --oneline -10
ãªãã10ãããããã«å€ãã®ã³ãããã確èªãããå Žåã¯ãã³ãã³ãå®è¡æã«git lol -n 30
ãªã©ãšæå®ããã°ãã®æ°ã ãã³ããããåºåãããŸãã
--grep
ã§ã³ãããã¡ãã»ãŒãžã§æ€çŽ¢ãã
--grep=ä»»æã®æå
ãšããããšã§ãã³ãããã¡ãã»ãŒãžã«ãã£ãŠã³ããããæ€çŽ¢ããããšãã§ããŸãã以äžã®äŸã ãšãã³ãããã¡ãã»ãŒãžã«Rename
ãå«ãŸããŠããã³ããããåºåãããŸãã
$ git log --oneline --grep=Rename
cb039c3 (HEAD -> main) Rename index.html
ãªãã--grep
ã®ã¿ã§æ€çŽ¢ãããšcase sensitiveãã€ãŸããã¢ã«ãã¡ãããã®å€§æåå°æåãåºå¥ãããŸããäŸãã°--grep=rename
ãšãããšåºåãããŸããã
$ git log --oneline --grep=rename
ãã®å Žåã-i
ïŒ--regexp-ignore-case
ã®ã·ã§ãŒããã³ãïŒãä»äžãããšã倧æåå°æååºå¥ãªãåºåãããŸãã
$ git log --oneline -i --grep=Rename
ae45f13 Rename index.html
ãŸããæ€çŽ¢ããæååã«ã¯æ£èŠè¡šçŸã䜿çšã§ããŸãã
# å
é ãEã®ã³ãããã¡ãã»ãŒãžã®ã¿åºå
$ git log --grep=^E --oneline
dc38817 Edit index.html
--grep
ã®çµæãå転ããããã€ãŸããRename
ãå«ãã³ãããã¡ãã»ãŒãžãé€ãã«ã¯ã--invert-grep
ãä»äžããŸãã
$ git log --grep=Rename --invert-grep --oneline
8359ebb (HEAD -> master, style.css) Remove index.ejs
1edf947 2nd Edit index.html
5a3abbc Create style.css
dc38817 Edit index.html
a81b18d Create index.html
ORãšAND
--grep
ãè€æ°äœ¿çšããå ŽåãORã§ã³ãããã¡ãã»ãŒãžãæ€çŽ¢ãããŸãã以äžã®äŸã ãšãRename
ãããã¯Create
ãå«ãŸããŠããã³ããããåºåãããŸãã
$ git log --oneline --grep="Rename" --grep="Create"
ae45f13 Rename index.html
5a3abbc Create style.css
a81b18d Create index.html
ãããANDã«ãããå Žåã--all-match
ãä»äžããŸãã以äžã®äŸã ãšãCreate
ãšhtml
ãäž¡æ¹å«ãŸããŠããã³ããããåºåãããŸãã
$ git log --oneline --all-match --grep="Create" --grep="html"
a81b18d Create index.html
-- <path>
ã§ç¹å®ã®ãã¡ã€ã«ã®å±¥æŽã確èªãã
ä»»æã®ãã¡ã€ã«ã«å€æŽããã£ãã³ãããã®ã¿åºåããå Žåã«ã¯ã-- [path]
ãšèšè¿°ããŸãã--stat
ã-p
ãšçµã¿åãããããšãå¯èœã§ãã
# index.ejsã®ã¿
$ git log --oneline -- index.ejs
8359ebb (HEAD -> master, style.css) Remove index.ejs
ae45f13 Rename index.html
# style.cssã®ã¿
$ git log --oneline -- style.css
4aefdf3 Create style.css
ãªãããã¹ã®åã«--
ãä»äžããŠããŸãããããã¯git log
ã«ãæž¡ããŠããã®ã¯ãã¡ã€ã«åã ãããšäŒããæå³ãæã£ãŠããŸãã
ããïŒindex.htmlãåŒã£ããããªããã©
ä»åã®äŸã§ã¯ãindex.html
ããindex.ejs
ã«ãã¡ã€ã«åãå€æŽããŠããŸãã-- index.ejs
ã§æ€çŽ¢ããŠããindex.html
ã察象ã®ã³ãããã¯åºåãããŸããã
ä»åã®ããã«ãæ¢ã«ã¯ãŒãã³ã°ããªãŒã«ååšããŠããªããã¡ã€ã«ã®ã³ããããæ€çŽ¢ãããå Žåã¯ã--follow
ãªãã·ã§ã³ãä»ããŠãã ããããªããŒã åã®index.html
ãæ€çŽ¢å¯Ÿè±¡ã«ãªããŸãã
ãªããåŒæ°ã®é çªã¯æ³šæãå¿
èŠã§ãã--follow -- ãã¡ã€ã«å
ãšããªããã°æ§ãã¡ã€ã«ãæ€çŽ¢ãããŸããã§ããïŒgit version 2.22.0ïŒã
$ git log --oneline --follow -- index.ejs
d7e6535 (HEAD -> main) Delete index.ejs
cb039c3 Rename index.html
360e27d 2nd Edit index.html
be1bf08 Edit index.html
fd4955b Create index.html
ãã¹ã®åã«--
ãä»ããã®ã¯ã©ããªæïŒ
ãã¡ã€ã«ããã¹ãèšè¿°ããŠã³ãããå±¥æŽãçµãã«ã¯--
ãä»äžãããšèª¬æããŸããããå®ã¯--
ã¯ã€ããªããŠããå€ãã®å Žåã¯ã¡ãããšåäœããŸããã€ããªããŠã¯ãããªãå Žåã«ã€ããŠãããã€ãæ€èšŒããŠã¿ãŸãã
çŸåšãindex.ejs
ã¯åé€ãããŠããŸãããããã§--
ãã€ããã«index.ejs
ãæå®ãããšãšã©ãŒã«ãªã£ãŠããŸããŸãã
# -- ãªãã§å®è¡
$ git log --oneline index.ejs
fatal: ambiguous argument 'index.ejs': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
ambiguous argument
ãã€ãŸããææ§ãªåŒæ°ããšããã¡ãã»ãŒãžãåºåããããäžå¯§ã«ããã¡ã€ã«åã®åã«--
ãã€ããŠãããšããã¢ããã€ã¹ãŸã§ãããŠããŸããã©ããããåé€ããªããŒã ãè¡ã£ãŠãã¯ãŒãã³ã°ããªãŒã«ååšããªããªã£ããã¡ã€ã«ãæ€çŽ¢ããå Žåã«ã¯--
ãå¿
èŠãããã§ãã
ã¯ãŒãã³ã°ããªãŒã«ååšããŠããstyle.css
ã§ããã°--
ãªãã§ãæ€çŽ¢ã§ããŸãã
$ git log --oneline style.css
4aefdf3 Create style.css
次ã«ããã¡ã€ã«åãšåããã©ã³ããåãããŠããå Žåã«ã€ããŠæ€èšŒããŸãã
ä»ãã¯ãŒãã³ã°ããªãŒã«ã¯style.css
ããããŸããããstyle.css
ãšããååã®ãã©ã³ããåããŸããç¹ã«ã³ãããã¯ããªããŠOKã§ãã
$ git checkout -b style.css
ããã§--
ãæž¡ããªãã§git log
ãå®è¡ãããš
$ git checkout main
$ git log --stat --oneline develop
fatal: ambiguous argument 'develop': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
ãŸãããŠãambiguous argument
ããææ§ãªåŒæ°ãã®ããèŽåœçãªãšã©ãŒãçºçããŠããŸãããstyle.css
ãã¡ã€ã«ããããstyle.css
ãã©ã³ãããããã©ãã©ã£ã¡ã®ããšèšã£ãŠãã®ïŒããšèšãããŠããŸãã
-- style.css
ãšããããšã§ãšã©ãŒãªãåºåãããããšã確èªããŠãããŸãã
$ git log --oneline -- style.css
4aefdf3 Create style.css
ãŸãšãããšã
- ð€ åºæ¬çã«ã¯
--
ãªãã§ããã¡ã€ã«ã§ã³ããããçµãã - ð€ ãã ããã¯ãŒãã³ã°ããªãŒã«ãªããã¡ã€ã«ã§çµãå Žåã«ã¯
--
ãä»äžãã - ð€ ãã¡ã€ã«åãšãã©ã³ãåã被ã£ãŠããå Žåã«ã
--
ãä»äžãã
ãšèããŠãããšæããŸãã
ãªããç§ã¯åžžã«--
ãä»äžããŠãã掟ã§ãã
--diff-filter
ã§å€æŽå
容ã§ã³ããããçµã
--diff-filter
ãªãã·ã§ã³ãä»ããããšã§ãããã¡ã€ã«ãåé€ãããã³ãããã ããããªããŒã ãããã³ãããã ãããšãã颚ã«ã³ããããåºåããããšãã§ããŸãã
--diff-filter=D
ãšãã颚ã«æå®ããŠã¿ãŸããD
ã¯Deleted
ã®ããšã§ããã€ãŸãããã¡ã€ã«ãåé€ãããã³ãããã®ã¿ãåºåãããŸãã
$ git log --oneline --diff-filter=D
d7e6535 (HEAD -> main) Delete index.ejs
D
以å€ã«ãã以äžã®ãããªå€ãæž¡ããŸãã
å€ | ã³ãããã®å 容 |
---|---|
A(Added) | è¿œå |
M(Modify) | å€æŽ |
R(Renamed) | ãªããŒã |
C(Copied) | ãã¡ã€ã«ã³ã㌠|
T(Type?) | ã¿ã€ããå€æŽïŒã·ã³ããªãã¯ãªã³ã¯ãžã®å€æŽãªã©ïŒ |
# ãã¡ã€ã«ãæ°ããè¿œå ããã³ãããã®ã¿
$ git log --oneline --diff-filter=A
4aefdf3 Create style.css
fd4955b Create index.html
# ãã¡ã€ã«ã®å
容ãå€æŽããã³ãããã®ã¿
$ git log --oneline --diff-filter=M
360e27d 2nd Edit index.html
be1bf08 Edit index.html
# ãã¡ã€ã«ããªããŒã ããã³ãããã®ã¿
$ git log --oneline --diff-filter=R
ae45f13 Rename index.html
# ãã¡ã€ã«ãã³ããŒããã³ãããã®ã¿ïŒä»åã®äŸã§ã¯è©²åœãªãïŒ
$ git log --oneline --diff-filter=C
ãããŠãå€ãå°æåã«ããããšã§æå³ãå転ãããããšãã§ããŸããã€ãŸãã--diff-filter=d
ãšãããšãåé€ããã£ãã³ããã以å€ãåºåãããŸãã
$ git log --oneline --diff-filter=d
ae45f13 Rename index.html
1edf947 2nd Edit index.html
5a3abbc Create style.css
dc38817 Edit index.html
a81b18d Create index.html
--since
ãš--until
ã§æ¥ä»ã§çµã
以äžã®ãããªã³ãããå±¥æŽããããšããŸãã2017幎ãã2020幎ãŸã§ãå幎ã®1æ1æ¥ã«ã³ããããè¡ã£ãŠãããèš4åã®ã³ãããå±¥æŽããããŸãã
$ git log --format=fuller
commit 13a83c31fc4558b811ae2c0dbb373a60d2359c77 (HEAD -> main)
Author: toriwatari <toriwatari@toriwatari.com>
Date: Fri Jan 10 00:00:00 2020 +0900
2020 commit
commit 0fb21bf1e009cd3edb4036bc167db0cb93c1c98b
Author: toriwatari <toriwatari@toriwatari.com>
Date: Tue Jan 1 00:00:00 2019 +0900
2019 commit
commit 41ece2df6ad958e89ae9ba91e08d82c3d476ec9d
Author: toriwatari <toriwatari@toriwatari.com>
Date: Mon Jan 1 00:00:00 2018 +0900
2018 commit
commit d4657a563990338265ed5af1ff90f8e971546560
Author: toriwatari <toriwatari@toriwatari.com>
Date: Sun Jan 1 00:00:00 2017 +0900
2017 commit
--sinse="<date>"
ãšããããšã§ä»»æã®æ¥ä»ä»¥éã«ã³ããããããã³ãããã®ã¿åºåã§ããŸãã以äžã®äŸã ãšã2018幎1æ1æ¥ä»¥éãè¡šããŸãã
$ git log --since="2018-01-01:00:00:00" --oneline
13a83c3 (HEAD -> main) 2020 commit
0fb21bf 2019 commit
41ece2d 2018 commit
æ¥ä»ã®ãã©ãŒãããã§ããè²ã ãªãã®ã«å¯Ÿå¿ããŠããããã§ãã
# YYYY-MM-DD
$ git log --since="2018-01-01"
# YYYY/MM/DD
$ git log --since="2018/01/01"
# YYYY MM DD
$ git log --since="2018 01 01"
# DD/MM/YYYY
$ git log --since="01/01/2018"
# UNIXã¿ã€ã ã¹ã¿ã³ã
$ git log --since="1514732400"
# 10é±éå
$ git log --since="10 week age"
# å
æ
$ git log --since="last month"
ãªãããã©ãŒãããã®äžéšã®ã¿æå®ããå Žåã®åäœã§ãããæå®ããŠããªãç®æã¯çŸåšã®æ¥æã§è£å®ãããããã§ãã
以äžã®äŸã§ã¯ãYYYYã«åœãã2019
ã®ã¿æå®ããŠããŸããåäœããŸãããã ã2019幎1æ1æ¥ã®ã³ãããã¯è¡šç€ºãããŸãããäºæ³ã§ãããå®è¡ããæ¥ä»ã®3æ3æ¥ãšãã®æéã§çµã蟌ã¿ãããããšã«ãªããšæ³åããŸããã
$ git log --since="2019" # YYYYã®ã¿
commit 13a83c31fc4558b811ae2c0dbb373a60d2359c77 (HEAD -> main)
Author: toriwatari <toriwatari@toriwatari.com>
Date: Fri Jan 10 00:00:00 2020 +0900
2020 commit
# ä»æ¥ã¯2020/03/03ãªã®ã§ã
# --since="2019/03/03(+ãã®æã®æé)"ãšã¿ãªããã?
æ€èšŒãããšããäžèšã®ããã«ãªã£ãŠãããšæšå¯ããã®ã§ããèªä¿¡ã¯ãããŸããã
--until
ã¯--since
ã®éãä»»æã®æ¥ä»ä»¥åã«ã³ããããããã³ãããã®ã¿åºåããŸãã
$ git log --until="2018-01-01:00:00:00" --oneline
# 2018幎1æ1æ¥ä»¥å
41ece2d 2018 commit
d4657a5 2017 commit
ãŸãã--since
ãš--until
ãçµã¿åãããããšã§ãããæ¥ä»¥éãããæ¥ä»¥åããšãã颚ã«æ¥æãçµã蟌ããŸãã
$ git log --since="2017-06-30" --until="2018-06-29" --oneline
41ece2d 2018 commit
--relative-date
ã§æ¥ä»ãçžå¯Ÿè¡šç€ºãã
éåžžãã³ãããã®æ¥ææ
å ±ã¯YYYY-MM-DDãšãã£ã颚ã«çµ¶å¯Ÿè¡šç€ºãããŸããã--relative-date
ãªãã·ã§ã³ãæž¡ãããšã§ãããæåãããæéåããšãã£ãçŸåšã®æ¥æã«å¯Ÿããçžå¯Ÿçãªåœ¢åŒã§åºåããããšãå¯èœã§ãã
$ git log --relative-date --abbrev-commit
commit 1527aea (HEAD -> main)
Author: toriwatari <toriwatari@toriwatari.com>
Date: 3 minutes ago # 3åå
4th-commit
commit 0acb905
Author: toriwatari <toriwatari@toriwatari.com>
Date: 6 days ago # 6æ¥å
3rd commit
commit 77e12e9
Author: toriwatari <toriwatari@toriwatari.com>
Date: 5 months ago # 5ãæå
2nd commit
--merge
ãš--no-merge
ã§ããŒãžé¢ä¿
--merges
ã§ããŒãžã³ãããã®ã¿ã--no-merges
ã§ããŒãžã³ããããé€å€ããŠãã°ãåºåããŸãã
$ git log --graph --all --oneline
* ba08362 (HEAD -> develop, main) Merge branch 'develop'
|\
| * fa906d1 dev commit
* | be5f689 main commit
|/
* 4f4d558 initial commit
# ããŒãžã³ãããã®ã¿
$ git log --merges --oneline
ba08362 (HEAD -> develop, main) Merge branch 'develop'
# ããŒãžã³ããããé€å€
$ git log --no-merges --oneline
be5f689 main commit
fa906d1 dev commit
4f4d558 initial commit
--Author
ãš--Committer
ããã¯ãã®ãŸãŸã--author="ãã"
ã--committer="ãã"
ã®åœ¢ã§èšè¿°ã§ããŸãã
$ git log --author="alien"
commit 9061b6e9231fac0baf0b8967773e26b66517e6ca
Author: alien <alien@andromeda.space> # Author
Date: Fri Mar 6 16:25:04 2020 +0900
ç§ã¯å®å®äººã
# Committerã確èªããå Žåã¯ãfullerãªãã·ã§ã³ãä»ããŠãã ããã
$ git log --committer="toriwatari" --format="fuller"
commit c85203de19d282266cdcfe73f800a66a49486e66 (HEAD -> main)
Author: toriwatari <toriwatari@toriwatari.com>
AuthorDate: Fri Mar 6 16:27:08 2020 +0900
Commit: toriwatari <toriwatari@toriwatari.com> # Committer
CommitDate: Fri Mar 6 16:27:08 2020 +0900
create index.html
ã³ãããå±¥æŽã®äœãçŽã
ããŠãããããã¯å¥ã®ãªããžããªã䜿ã£ãŠè§£èª¬ããŸãã以äžã®ã³ãã³ããé ã«å®è¡ããã°ããªããžããªãåçŸã§ããŸãã
ãŸãã¯script.js
ãäœæã以äžã®å
容ãèšè¿°ããŸãã
const func = (str)=> {
console.log(str);
};
let message = "Hello World";
func(message);
ãã®script.js
ãã³ãããããŸãã
$ git add .
$ git comm-t -m "funcé¢æ°ãäœæ";
次ã«ãmessage
å€æ°ã®å®£èšæããlet
ããconst
ã«å€æŽããŸãã
...(ç¥)
const message = "Hello World";
...(ç¥)
ãããã³ãããããŸãã
$ git add .
$ git commit -m "letããconstã«å€æŽ"
-S
ã§ç¹å®ã®æååã®å€æŽã§çµã
-S
ãªãã·ã§ã³ã®åŸã«ä»»æã®æååãæž¡ãããšã§ããã¡ã€ã«ã®äžèº«ãåç
§ããä»»æã®æååãèšè¿°ãããïŒåé€ãããã³ãããã«çµã£ãŠåºåãããããšãã§ããŸãã--grep
ãªãã·ã§ã³ã¯ã³ãããã¡ãã»ãŒãžã®æ€çŽ¢ã§ããã-S
ãªãã·ã§ã³ã¯ãã¡ã€ã«ã®äžèº«ãèŠããšããéãããããŸãã
äŸãã°git log -S message
ãšãããšããmessage
ã£ãŠå€æ°åã£ãŠãã€èšè¿°ããããã ã£ãïŒãã調ã¹ãããšãã§ããŸãã
$ git log --oneline -S message
b7a09d0 (HEAD -> master) funcé¢æ°ãäœæ
ãã®-S
ãªãã·ã§ã³ã¯ãå€æŽå
容ã確èªãã-p
ïŒååå匷ããŸãããïŒãšäžç·ã«æž¡ããšãå
·äœçã«ã©ããªå€æŽããã£ããã確èªã§ããã®ã§ããå¹æçã§ãã
$ git log --oneline -S message -p
fa964e3 funcé¢æ°ãäœæ
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..ea8a27a
--- /dev/null
+++ b/script.js
@@ -0,0 +1,7 @@
+const func = (str) => {
+ console.log(str);
+};
+
+let message = "Hello World";
+
+func(message);
\ No newline at end of file
ç¶ããŠãmessage
ãåé€ããŠã¿ãŸãããã
// ãã®è¡ãåé€ããŠãã ããã
const message = "Hello World";
ã³ãããããŸãã
$ git add .
$ git commit -m "å€æ°ãåé€"
äžèšã®éããmessage
ãåé€ãããã³ããããåºåãããŠããŸãã
$ git log --oneline -S message
83130f1 (HEAD -> master) å€æ°ãåé€
fa964e3 funcé¢æ°ãäœæ
$ git log --oneline -S message -p
83130f1 (HEAD -> master) å€æ°ãåé€
diff --git a/script.js b/script.js
index aa50b5e..30ca481 100644
--- a/script.js
+++ b/script.js
@@ -2,6 +2,4 @@ const func = (str) => {
console.log(str);
};
-const message = "Hello World";
func(message);
\ No newline at end of file
fa964e3 funcé¢æ°ãäœæ
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..ea8a27a
--- /dev/null
+++ b/script.js
@@ -0,0 +1,7 @@
+const func = (str) => {
+ console.log(str);
+};
+
+let message = "Hello World";
+
+func(message);
\ No newline at end of file
-G
ãšãããªãã·ã§ã³ããã
å®ã¯ã-S
ãšäŒŒã-G
ãšãããªãã·ã§ã³ããããŸãããã®ãªãã·ã§ã³ããã¡ã€ã«ã®äžèº«ã確èªããŠã³ããããçµããŸãã
äŸãã°ãgit log --oneline -G let
ãšããŠã¿ãŸããããlet
ãè¿œå ãããæåã®ã³ããããlet
ããconst
ã«å€æŽããã2çªç®ã®ã³ããããåºåãããŸãã
$ git log --oneline -G let
fc8313a letããconstã«å€æŽ
fa964e3 funcé¢æ°ãäœæ
ã§ã¯ãgit log --oneline -G message
ãšããŠã¿ãŸãããã3è¡åºåãããŸããgit log --oneline -S message
ãšãããš2è¡åºåãããŸãã®ã§ã2çªç®ã®ã³ããããäœåã«åºåãããŠããããšãåãããŸãããã®éãã¯äœã§ããããã
$ git log --oneline -G message
83130f1 (HEAD -> master) å€æ°ãåé€
fc8313a letããconstã«å€æŽ
fa964e3 funcé¢æ°ãäœæ
# -Sã ãš2çªç®ã®ã³ãããã¯åºåãããªã
$ git log --oneline -S message
83130f1 (HEAD -> master) å€æ°ãåé€
fa964e3 funcé¢æ°ãäœæ
2ã€ã®ãªãã·ã§ã³ã®ç¹åŸŽãããå³å¯ã«èšèªåããŸãã-S
ã¯ä»»æã®æååãè¿œå /åé€ãããã³ããããåºåããŸãïŒåè¿°ããŠããŸãïŒã
2çªç®ã®ã³ãããã¯let
ããconst
ã«å®£èšæãå€ãããŸããããmessage
ãšããæååã«å€åã¯ãããŸãããããã®ããåºå察象å€ã§ãã
察ããŠ-G
ãªãã·ã§ã³ã¯ãå€æŽè¡ã®äžã«ä»»æã®ã¡ãã»ãŒãžãå«ãŸããŠããã³ããããåºåããŸãã2çªç®ã®ã³ãããã¯ïŒäœåºŠãæžããŸããïŒlet
ããconst
ã«å®£èšæã代ãããGitã¯ãã®1è¡ãå€æŽè¡ã ãšèŠåããŸãããããŠããã®è¡ã®äžã«message
ãšããæååãããããã-G
ãä»ãããšãã®ã³ããããåºåãããŸãã
message
ãšããæååèªäœã®è¿œå ïŒåé€ãæ€ç¥ããã®ã§ã¯ãªããå€æŽè¡ã®äžã«message
ããããã©ããã§å€æããŸãã
ãŸãšã
ãªãã·ã§ã³å | åºå |
---|---|
-n | åºåæ°ãçµã |
â | ãã¡ã€ã«ãã¹ã§çµã |
âdiff-filter | å€æŽå 容ã§çµã |
âsince, âuntil | ç¹å®ã®æ¥ä»ä»¥éãŸãã¯ä»¥åã§çµã |
ârelative-date | æ¥ä»ãçžå¯Ÿè¡šç€ºãã |
âmerge,âno-merge | ã§ããŒãžé¢ä¿ |
âauthorãâcommitter | AuthorãCommitterã§çµã |
-S | ãã¡ã€ã«ã®å 容ã§çµã |
ããã«ããŠãããªãã·ã§ã³ã¯ããªãã®çš®é¡ããããŸãããåç·šãšäžç·šã§çµæ§ãªæ°ã®ãªãã·ã§ã³ã玹ä»ããŸããããããã§ãå šäœã®äžéšã«éããŸããã
ãªãã¡ã¬ã³ã¹ãèŠããšé¬Œã®ãããªæ°ã®ãªãã·ã§ã³ãèŒã£ãŠããã®ã§ãããäžæãåããªãã£ããããããæå³ãåãããªããããªç©ããããŸããïŒç§ã®ç解床ã®åé¡ãããããŸãããïŒãèªåã§ç解ããŠèª¬æã§ããæ°ãããªãã£ãã®ã§ããã®èŸºãã§çµäºããŸãã
ãšããã€ã€ããŸã åŸç·šãæ®ã£ãŠããŸãã®ã§ãã²èªãã§ã¿ãŠãã ããã