Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
14Richa committed Jul 10, 2024
1 parent 301eae1 commit f9b1b38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions _posts/2024-07-10-delete-multiple-branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ Before getting into the how, let’s briefly touch on why we should delete old b
3. _Avoid Confusion_ : Prevents accidental work on outdated branches.
4. _Collaboration_ : Keeps the repository clean for team members.

### Deleting Local Branches
### **Deleting Local Branches**

To delete multiple local branches, you can use the following methods:


**Step 1. List Branches**
**Step 1: List Branches**

List all the branches to identify which ones you want to delete.

```shell
git branch
```

**Step 2. Delete Branches**
**Step 2: Delete Branches**

Use a loop in your shell to delete the branches. For example, to delete branches named feature1, feature2, and feature3 :

Expand All @@ -45,15 +45,15 @@ done
> Note : The `-d` option will delete the branch only if it has been fully merged. To force delete, use `-D`.

**Delete All Merged Branches**
#### Delete All Merged Branches

To delete all branches that have been merged into the current branch, use the following command :

```shell
git branch --merged | grep -v '\*' | xargs -n 1 git branch -d
```

### Deleting Remote Branches
### **Deleting Remote Branches**

Deleting branches on the remote server is done in a different way. Here’s how you can use the `git push` command to do it:

Expand Down

0 comments on commit f9b1b38

Please sign in to comment.