r3bl-org/r3bl-open-core

[giti] `giti branch delete`: Handle user deleting current branch which is main development branch

Opened this issue · 0 comments

Prerequisites

Install and run giti

  1. Move to ./tuify folder in your terminal
  2. Run nu run.nu install-giti to install giti locally to ~/.cargo/bin
  3. Run giti from anywhere on your system
  4. To delete one or more branches in your repo run giti branch delete

Private giti design document

Task

  • User's current branch is main development branch and user is deleting it.
  • Before displaying a success message showing all local branches that got deleted, show another Tuify component asking which branch to switch to since user is deleting main/master/develop branch (show a list of branches that are left)
> 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
  ›  ✔ Current: main
     ☐ NadiaIdris/branch-2
     ☐ NadiaIdris/branch-3
     ☐ NadiaIdris/branch-4
-----------------------------------------------------
(next step)
Space:         select or unselect branches
Return:        confirm selection
Esc, Ctrl+C:   exit program

You are deleting "main" branch. Please choose branch to switch to:
    ◉ aaronsmith/branch-1 
    ◌ NadiaIdris/branch-2      
    ◌ NadiaIdris/branch-3  
    ◌ NadiaIdris/branch-4  
-----------------------------------------------------
(next step)
Space:         select or unselect branches
Return:        confirm selection
Esc, Ctrl+C:   exit program

✅ `main` deleted
Current branch switched to `aaronsmith/branch-1`