forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
Command line tips and tricks
Nick Desaulniers edited this page Sep 27, 2022
·
29 revisions
Given sha
of commit, we want to know the first tag that contains the fix.
tag=$1
git describe --match 'v*' --contains "$tag" | sed 's/[~^].*//'
$ git log -S <string> <file>
(via Saravana Kannan)
$ git show --format=format:'commit %h ("%s")' 69d0db01e210e07fe915e5da91b54a867cda040f | head -n1
commit 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")
Can also be done with git's formatter.
Add this to your .gitconfig
file:
[pretty]
commit = commit %h (\"%s\")
And then generate the formatted message like so:
$ git log -1 --pretty=commit 2de9e73d252d2f1100fcf4dfd7013cc4a93d82d6
commit 2de9e73d252d ("nfsd: use correct format characters")
Similarly can be done for Fixes: ...
messages.
Link: https://www.kernel.org/lore.html
Alternatively, you can use a generic message-id redirector in the form: https://lore.kernel.org/r/message@id
Recommend installing b4.
Examples:
# Link to patch (series)
link="https://lore.kernel.org/r/[email protected]/"
or
link="https://lore.kernel.org/lkml/[email protected]/"
# Apply patch (series) in local Git
$ b4 am $link -o - | git am
# Download patch (series)
$ b4 -d am $link
$ sudo rm -r /boot/config-$(uname -r) /boot/initrd.img-$(uname -r) /boot/System.map-$(uname -r) /boot/vmlinuz-$(uname -r) /lib/modules/$(uname -r)
Simulate the check of your patch:
$ cd /path/to/linux.git
$ git send-email --dry-run --to-cmd='scripts/checkpatch.pl' 0001-Makefile-correct-prefix-for-Clang-builds.patch
Simulate to get the list of maintainers:
$ git send-email --dry-run --to-cmd='scripts/get_maintainer.pl -i' 0001-Makefile-correct-prefix-for-Clang-builds.patch
- Note: Drop
--dry-run
for a real submission. - Note: Install the package of your distribution shipping
git-send-email
(Debian:git-email
).
Make sure to set LLVM=1
when running tools/testing/ktest/config-bisect.pl
.
$ LLVM=1 ./tools/testing/ktest/config-bisect.pl
$ ./tools/testing/kunit/kunit.py run --arch=i386 memcpy --make_options LLVM=1