Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Force Deletion of Branches #49

Open
MichaelFoss opened this issue Jan 4, 2023 · 0 comments
Open

Allow Force Deletion of Branches #49

MichaelFoss opened this issue Jan 4, 2023 · 0 comments

Comments

@MichaelFoss
Copy link
Collaborator

When a branch is not fully merged, branch deletion is impossible within Git Commander.

Consider the following repo:

❯ mkdir git-repo
❯ cd git-repo
❯ git init
Initialized empty Git repository in ~/git-repo/.git/
❯ git checkout -b main
Switched to a new branch 'main'
❯ touch initial-commit
❯ git add --all
❯ git commit -m "Initial commit"
[main (root-commit) 431a8c2] Initial commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 initial-commit
❯ git branch
* main
❯ git checkout -b tmp
Switched to a new branch 'tmp'
❯ touch branch-file
❯ git add --all
❯ git commit -m "Branch commit"
[tmp 49ef858] Branch commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 branch-file
❯ git checkout main
Switched to branch 'main'

The resultant Git repo looks like this:

  * tmp
 /
* main

Trying to delete the branch results in an error, because the branch is not yet fully merged:

❯ git branch --delete tmp
error: The branch 'tmp' is not fully merged.
If you are sure you want to delete it, run 'git branch -D tmp'.
❯ git branch
* main
  tmp

In order to delete the unmerged branch, one must do a force delete:

❯ git branch --delete --force tmp
Deleted branch tmp (was 49ef858).
❯ git branch
* main

Git Commander does not allow for force deletion of branches. In the event that the user is requesting the deletion of a non-fully merged branch, Git Commander should provide a confirmation dialog stating that the branch is not fully merged. If the user cancels from the dialog, the deletion should do nothing (as it does today), but if the user confirms from the dialog, the deletion attempt should be re-executed forcefully (i.e. with the --force flag).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant