Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanbrasiliano/gitflow-remove-branch
This script enables you to delete a specified branch from both your local and remote Git repositories, ensuring that the branch is completely removed from all locations.
https://github.com/yanbrasiliano/gitflow-remove-branch
gitflow gitflow-workflow shell-script
Last synced: 28 days ago
JSON representation
This script enables you to delete a specified branch from both your local and remote Git repositories, ensuring that the branch is completely removed from all locations.
- Host: GitHub
- URL: https://github.com/yanbrasiliano/gitflow-remove-branch
- Owner: yanbrasiliano
- License: mit
- Created: 2023-04-20T14:14:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-04T02:53:09.000Z (8 months ago)
- Last Synced: 2024-11-07T15:37:43.722Z (3 months ago)
- Topics: gitflow, gitflow-workflow, shell-script
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gitflow Remove Branch
This script allows you to delete a branch from both your local and remote Git repositories.
## Usage
1. **Make the script executable:**
```sh
chmod +x delete-branch.sh
```2. **Run the script:**
```sh
./delete-branch.sh
```3. **Follow the prompts:**
- Enter the name of the branch you want to delete.
## How It Works
1. The script checks if the branch exists locally:
- If it does, the branch is deleted locally.
- If it does not, a message is displayed indicating the branch does not exist locally.2. The script then checks if the branch exists remotely:
- If it does, the branch is deleted remotely.
- If it does not, a message is displayed indicating the branch does not exist remotely.3. Output messages will indicate the status of the deletion process for both local and remote branches.
## Script Details
The script uses the following Git commands:
1. `git show-ref` - Checks if the branch exists locally.
2. `git branch -D` - Deletes the branch locally.
3. `git ls-remote` - Checks if the branch exists remotely.
4. `git push --delete` - Deletes the branch remotely.## Note
Be careful when deleting a branch, as this action cannot be undone. Ensure that you have committed all necessary changes and have a backup before running this script.