r3bl-open-core
r3bl-open-core copied to clipboard
[giti] `giti branch delete`: If user deleted current branch, switch them to main development branch
Prerequisites
Install and run giti
- Move to
./tuify
folder in your terminal - Run
nu run.nu install-giti
to installgiti
locally to~/.cargo/bin
- Run
giti
from anywhere on your system - To delete one or more branches in your repo run
giti branch delete
Task
User wants to delete current branch which is not main development branch. Main development branch is generally called main, master, develop or trunk.
Improve giti branch delete
user experience (UX)
- Use case: User deletes a current branch which is not main development branch
- Switch user to local main development branch (main/master/develop/trunk etc)
Below are the UX steps:
> giti branch delete
Space: select or unselect branches
Return: confirm selection
Esc or Ctrl+C: exit program
Please select branches you want to delete
☐ aaronsmith/branch-1
☐ main
› ✔ (current) NadiaIdris/branch-2
☐ NadiaIdris/branch-3
☐ NadiaIdris/branch-4
--------------------------------------------------------
(next step)
Space: select or unselect branches
Return: confirm selection
Esc or Ctrl+C: exit program
Confirm deleting 1 branch: NadiaIdris/branch-2?
◉ Yes, delete branch
◌ Exit
--------------------------------------------------------
(next step)
Space: select or unselect branches
Return: confirm selection
Esc or Ctrl+C: exit program
✅ `NadiaIdris/branch-2` deleted
Your current branch is now `main`
Note: Issue #276 takes care of prefixing current branch with (current)
.
Current behaviour
Currently if a user is on a feature branch and then tries to delete that branch, they get an error.
Change that so if user is on a feature branch and then tries to delete that branch, we switch them to main/master branch and delete the current feature branch. If they don't have a main/master branch for whatever reason, we show them a single select component with the local branches to choose from.