Add delete snippets
This commit is contained in:
committed by
Chalarangelo
parent
09872076b1
commit
3ce861522c
28
snippets/delete-detached-branches.md
Normal file
28
snippets/delete-detached-branches.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Delete detached branches
|
||||
tags: repository,branch,intermediate
|
||||
---
|
||||
|
||||
Deletes all detached branches.
|
||||
|
||||
- Use `git fetch --all --prune` to garbage collect any detached branches.
|
||||
- This is especially useful if the remote repository is set to automatically delete merged branches.
|
||||
|
||||
```sh
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
```sh
|
||||
git checkout master
|
||||
git branch
|
||||
# master
|
||||
# patch-1
|
||||
# patch-2
|
||||
|
||||
# Assuming `patch-1` is detached
|
||||
git fetch --all --prune
|
||||
|
||||
git branch
|
||||
# master
|
||||
# patch-2
|
||||
```
|
||||
Reference in New Issue
Block a user