Skip to content

Commit 4d89ab1

Browse files
committed
add git tip trick
1 parent d8f09be commit 4d89ab1

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

git/git-tips-tricks.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,43 @@ If git detects typos and can identify exactly one valid command similar to the e
118118
- "immediate": run the suggested command immediately.
119119
- "prompt": show the suggestion and prompt for confirmation to run the command.
120120
- "never": don’t run or show any suggested command.
121+
122+
## 6. git-notes
123+
124+
Adds, removes, or reads notes attached to objects, without touching the objects themselves.
125+
126+
```shell
127+
git notes add
128+
git notes add -m "my note"
129+
# namespacing
130+
# default namespace: "commits"
131+
git notes --ref jenkins add "build pass"
132+
git notes --ref jenkins show HEAD
133+
git log --show-notes=jenkins
134+
git log --show-notes="*"
135+
136+
# push
137+
# Like tags, notes aren't pushed by default
138+
git push origin refs/notes/commits
139+
git push origin "refs/notes/*"
140+
141+
# fetch
142+
# Notes aren't fetched by default.
143+
git fetch origin refs/notes/commits:refs/notes/commits
144+
git fetch origin "refs/notes/*:refs/notes/*"
145+
146+
# to fetch notes by default
147+
vim .git/config
148+
149+
150+
#edit this part
151+
152+
[remote "origin"]
153+
fetch = +refs/heads/*:refs/remotes/origin/*
154+
155+
#to become
156+
157+
[remote "origin"]
158+
fetch = +refs/heads/*:refs/remotes/origin/*
159+
fetch = +refs/notes/*:refs/notes/*
160+
```

0 commit comments

Comments
 (0)