Home > Development Tools > git > body text

How to batch delete branches in git

WBOY
Release: 2022-01-04 16:35:06
Original
12394 people have browsed it

Method: 1. Use the "git branch|grep "option"|xargs git branch-d" command to delete the local branch; 2. Use the "git branch|grep "option"|xargs git push origin--delete ” command deletes the remote branch.

How to batch delete branches in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How does git delete branches in batches

git batch deletes local branches

Enter the project, for example, if you want to delete all local features Branch, just execute the following command:

git branch -a | grep "^  feature*" | xargs git branch -D
Copy after login

git batch delete remote branches

Enter the project, for example, if you want to delete the release branch starting with 201803, just execute the following command:

git branch -a | grep -o "release/201803.*" | xargs -I {} git push origin :{}
Copy after login

Recommended study: "Git Tutorial"

The above is the detailed content of How to batch delete branches in git. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!