Skip to content

Commit

Permalink
add git search
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie committed May 28, 2024
1 parent 826a7ee commit 7913bd3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions content/notes/search string in any git branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Search for a string across all git branches
date: 2024-05-28
tags:
- git
- shell
---
I've been working across a few branches lately, and couldn't remember the name of a git branch containing some work I'd done. I did, however, remember the name of an interface I'd defined.

Seach all git branches for a specific string, with this

```bash
git rev-list --all | xargs git grep 'SEARCH STRING'
```

If a result is found, you'll be given the git SHA

Get info for the sha

```bash
git show <THE SHA>
```

And you'll see something like this

```
commit 68f9ecc4d46716f572de943ee90bf236c3065ef4 (HEAD -> ellie/ui-me)
Author: Ellie Huxtable <[email protected]>
Date: Sat May 25 09:51:56 2024 +0100
wip
```

> [!question] I thought it might also be cool to have [Atuin](https://atuin.sh) track git branches, alongside everything else. Maybe a custom data column?

0 comments on commit 7913bd3

Please sign in to comment.