aboutsummaryrefslogblamecommitdiff
path: root/til.md
blob: b25de0d96d064874f6fc46534a29ebae48d2b937 (plain) (tree)




















































                                                                                                                 
---
layout: page
title: "TIL: Useful code snippets"
lang: en
ref: til
---
Useful code snippets[^source].

## Git custom work-tree checkout

```shell
git --work-tree=/path/to/outputdir checkout HEAD -- .
```
## Search in Git

Search log messages

```shell
git log --grep='Build 0051'
```

Search content in git history

```shell
git grep 'Build 0051' $(git rev-list --all)
```
## Find broken symlinks

```shell
find . -xtype l
```

## Kernel version
```shell
uname -r
```
## Sending email through the command line

```shell
mail eu@euandre.org -s "This is the subject" -aFrom:eu@euandre.org <<< 'This is the message'
```

## Git bisecting

Automatic Git bisect

```shell
git bisect start e1fd0a817d192c5a5df72dd7422e36558fa78e46 HEAD
git bisect run sh -c 'git clean -ffdx && ./bootstrap && ./configure --localstatedir=/var && make && git checkout'
```


[^source]: Shameless rip-off of [Anna e só](https://til.flourishing.stream/)