forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 15
Command line tips and tricks
Sedat Dilek edited this page Feb 4, 2021
·
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)
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-runfor a real submission. - Note: Install the package of your distribution shipping
git-send-email(Debian:git-email).
[ commit (sha1-id) ]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=6526b12de07588253a52577f42ec99fc7ca26a1f
Link: https://git.kernel.org/tip/tip/c/6526b12de07588253a52577f42ec99fc7ca26a1f
[ commit (12 digits) ]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=7b7891c7bdfd
Link: https://git.kernel.org/arm64/c/7b7891c7bdfd
Note: `tip/tip.git/commit` -> `tip/tip/c` but `arm64/linux.git/commit` -> `arm64/c` (even shorter when you have `linux.git` in the Link)
[ patch ]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/patch/?id=6526b12de07588253a52577f42ec99fc7ca26a1f
Link: https://git.kernel.org/tip/tip/p/6526b12de07588253a52577f42ec99fc7ca26a1f