Skip to content

Commit

Permalink
[Git] Switch branch with fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Apr 13, 2024
1 parent 86c76b0 commit 418b64a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,3 +692,15 @@ git -c versionsort.suffix=- tag --list --sort=version:refname
</div>

[🔗](https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---sortltkeygt)

### Switch branch with fzf

```bash
git branch --all |
grep -v '^[*+]' `: # ignore current branch` |
awk '{print $1}' `: # trim` |
fzf -0 --border --reverse \
--preview 'git show --color=always {-1}' |
sed 's/remotes/origin///g' |
xargs --no-run-if-empty git checkout
```

0 comments on commit 418b64a

Please sign in to comment.