Skip to content

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.

License

Notifications You must be signed in to change notification settings

yanbrasiliano/gitflow-remove-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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:

    chmod +x delete-branch.sh
  2. Run the script:

    ./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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages