2. 01 powerful git tricks
02 Modern code navigation without
TAGS
04 Send and update your patch
03 Mailing list and mail client
目
录
3. Basic git concepts
plumbing porcelain object
database
index
working
tree
object type branch tag
head/HEA
D
merge rebase bisect
4. git worktree --help
What How
Example Why
Worktree is your working directory without index and
object database
- git worktree add
- git worktree remove
- git worktree list
- git worktree move
…
Share the same project-wise git config
Share the same remotes
Easily manage different worktrees
Avoid frequently but annoying git checkout/switch
$ git worktree add -b emergency-fix ../temp
master
$ pushd ../temp
# ... hack hack hack ...
$ git commit -a -m 'emergency fix for boss'
$ popd
$ git worktree remove ../temp
5. Package your git repo!
Git bundle and archive
Git archive
Git bundle
Move objects and refs by
archive
Hisotry is also included
Create an archive of files
from a named tree
Play well with all git worktrees
and git clone!
History is excluded
git bundle create 4-19-
90.bundle 4-19-90
git archive -o 4-19-90.zip 4-
19-90 -9
Make clean is not required!
7. Git hooks
firstlove@LAPTOP-N1A5G5V0 ~/p/k/linux-sw (6a-inspur-wutip-421)> cat
.git/hooks/post-commit
exec git show --format=email HEAD | ./scripts/checkpatch.pl --strict --codespell
fire off custom scripts when
certain important actions occur.
8. Why ctags
Modern code navigation without TAGS
efficient Simple
Most kernel
developer use it
Universal
It is really fast even on machine with
performance
Works quite well with vanilla vim!
So, you can easily learn ctags from them
Have many languages support by default
9. Why not ctags
Modern code navigation without TAGS
Lack on the fly syntax
check
Code completion is
missing or unusable
Know nothing about
how your code will be
compiled
No other modern ide
features!
You cannot know if it can pass compliation until you
really compile it!
It has to index all codes, regardless of .config!
That’s why its ofter Inaccurate even just for code
navigation!
● codelen
● symbol rename
● semantic highlighting
● hierarchies
Cannot take use of other powerful lints!
Kernel is really big, it’s not pritical to remember all
apis.
Code completion is really your friend if you are a
newbiee.
10. Modern code navigation without TAGS
ccls
c/c++/object-c lsp server, which supports all features mentioned last page
Have nearly all editors support, including vim, emacs, neovim, vscode ...
11. Mailing list and mail client
1,000 messages
each day
Emails Only (without
anything else!)
Simple but sufficient
Poor man’s forum
LKML
12. Mailing list and mail client
git-send-email Mutt
mu4e
nmh
Mail client
13. Mailing list and mail client
smtp imap
refile
archive
Mail client
14. Send and update your patch
Describe, check and extract your patch (single patch)
./scripts/checkpatch.pl -g HEAD
git format-patch -1 HEAD
15. Send and update your patch
Describe, check and extract your patch (multiple patches)
# n is your commits number
$ ./scripts/checkpatch.pl -g HEAD-n
$ git format-patch -n HEAD
$ man git-format-patch # for more details
16. Send and update your patch
Get maintainer and mailing list
$ ./scripts/get_maintainer.pl drivers/gpu/drm/radeon/atom.c
Alex Deucher <alexander.deucher@amd.com>
(supporter:RADEON and AMDGPU DRM DRIVERS)
"Christian König" <christian.koenig@amd.com>
(supporter:RADEON and AMDGPU DRM DRIVERS)
David Airlie <airlied@linux.ie> (maintainer:DRM DRIVERS)
Daniel Vetter <daniel@ffwll.ch> (maintainer:DRM DRIVERS)
amd-gfx@lists.freedesktop.org (open list:RADEON and
AMDGPU DRM DRIVERS)
dri-devel@lists.freedesktop.org (open list:DRM DRIVERS)
linux-kernel@vger.kernel.org (open list)
17. Send and update your patch
Update your patch
It’s quite common that your first version of patch/patches have
problems you were not aware of. Maintainer(or someone else)
may reply your mail and point out your mistakes.
You can fix/improve your patch/patches then send v2/v3/v4/...:
$ git format-patch … –reroll-count n # n stands for the n times
you send the patch/patches
$ Add changelog in cover-letter
18. Send and update your patch
Update your patch
Example of changelog inside cover-letter:
Signed-off-by: chenli <chenli at uniontech.com>
---
v1->v2:
* Convert the other assignments of msg as well.
* Casting types to avoid static checker warnings.
---
drivers/gpu/drm/radeon/radeon_uvd.c | 34 ++++++++++++++---------------
1 file changed, 17 insertions(+), 17 deletions(-)
https://www.spinics.net/lists/amd-gfx/msg59986.html
19. Send and update your patch
Fix other commits
Add: “Fixes:” tag in the commit
message:
Fixes: 3fcb4f01deed ("drm/radeon: Use
kvmalloc for CS chunks")
Signed-off-by: Chen Li
<chenli@xxxxxxxxxxxxx>
---
changelog:
v1->v2: add Fixes: tag
drivers/gpu/drm/radeon/radeon_cs.c | 6 +++--
-
1 file changed, 3 insertions(+), 3 deletions(-)
https://www.spinics.net/lists/amd-
gfx/msg59986.html
If your commits aim to fix bug introduced from other commits, you should: