Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Remove merged branches from your local machine

Remove merged branches from your local machine If you work with a remote Git repository, you might encounter a situation where you still have branches on your local machine, but those branches have been removed from the remote…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Image description






Remove merged branches from your local machine



If you work with a remote Git repository, you might encounter a situation where you still have branches on your local machine, but those branches have been removed from the remote repository.




  • Open a bash terminal (if you are on Windows you will have git bash. CMD, and PowerShell will not work).


  • Run the following command:





    git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d






Let’s break down the command:



git fetch -p: This command fetches the branches and their commits from the remote repository to your local repository. The -p or --prune option removes any remote-tracking references (i.e., origin/branch-name) to branches that have been deleted on the remote repository.



&&: This is a logical AND operator. In the context of command-line operations, it means “execute the following command only if the previous command succeeded.”



git branch -vv: This command lists all local branches and their upstream branches. If a local branch’s upstream branch has been deleted, it will show [gone] next to it.



An example where  raw `deleted-branch` endraw  is deleted,  raw `only-local-branch` endraw  was never pushed to the remote repository, and  raw `main` endraw  and  raw `test-branch` endraw  are both local and remote.

An example where deleted-branch is deleted, only-local-branch was never pushed to the remote repository, and main and test-branch are both local and remote.



|awk '/:gone]/{print $1}': This part of the command pipes (|) the output of the previous command to awk, a text processing utility. The awk command is programmed to match lines containing :gone] and print the first field ($1) of those lines, which is the branch name.



![The result of git fetch -p && git branch -vv | awk ‘/: gone]/{print $1}’ given me only deleted-branch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/th99z8egahzsaja9om72.png)

The result of git fetch -p && git branch -vv | awk ‘/: gone]/{print $1}’ given me only deleted-branch



| xargs git branch -d: This part of the command pipes the output of the previous command (i.e., the names of the branches to be deleted) to xargs, which executes the git branch -d command for each input. The git branch -d command deletes a branch.



So, in summary, this command fetches updates from the remote repository, identifies local branches whose upstream branches have been deleted, and deletes those local branches.

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Remove merged branches from your local machine

Thematisch verwandte Begriffe: Remove, merged, branches, from · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-100902 | A vulnerability was determined in Barco ClickShare CX-20 Gen2 up to 02.…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag