r3bl-open-core icon indicating copy to clipboard operation
r3bl-open-core copied to clipboard

[giti] `giti branch delete`: If user deleted current branch, switch them to main development branch

Open NadiaIdris opened this issue 1 year ago • 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 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.

Image

NadiaIdris avatar Dec 12 '23 23:12 NadiaIdris