aviator-co / av

A command line tool to manage stacked PRs with Aviator
https://aviator.co
MIT License
259 stars 21 forks source link

how to delete branch? #458

Open hakanalpaydd opened 1 day ago

hakanalpaydd commented 1 day ago
~/Projects/web-next/services/consumer-web-next NVG-1076_chase_checkout_fix_country_code_bug
» av stack tree

  * NVG-1076_chase_checkout_fix_country_code_bug (HEAD)   
  │ https://github.com/doordash/web-next/pull/29805       
  │                                                       
  │ * NVG-1070_chase_web_next_add_is_card_payment_to_query
  │ │ https://github.com/doordash/web-next/pull/28303     
  │ │                                                     
  │ │ * NVG-1077_chase_m1_analytics                       
  │ │ │ https://github.com/doordash/web-next/pull/29973   
  ├─┴─┘                                                   
  * master                                                

~/Projects/web-next/services/consumer-web-next NVG-1076_chase_checkout_fix_country_code_bug
» av stack switch

  ✓ Checked out branch                                      

    * NVG-1076_chase_checkout_fix_country_code_bug (HEAD)   
    │ https://github.com/doordash/web-next/pull/29805       
    │                                                       
    │ * NVG-1070_chase_web_next_add_is_card_payment_to_query
    │ │ https://github.com/doordash/web-next/pull/28303     
    │ │                                                     
    │ │ * NVG-1077_chase_m1_analytics                       
    │ │ │ https://github.com/doordash/web-next/pull/29973   
    ├─┴─┘                                                   
    * master                                                

  Checked out branch master                                 

~/Projects/web-next/services/consumer-web-next master ⇣
» git branch --delete NVG-1076_chase_checkout_fix_country_code_bug
error: the branch 'NVG-1076_chase_checkout_fix_country_code_bug' is not fully merged
hint: If you are sure you want to delete it, run 'git branch -D NVG-1076_chase_checkout_fix_country_code_bug'
hint: Disable this message with "git config advice.forceDeleteBranch false"

~/Projects/web-next/services/consumer-web-next master ⇣
» git branch -D NVG-1076_chase_checkout_fix_country_code_bug
Deleted branch NVG-1076_chase_checkout_fix_country_code_bug (was 90bbcb8ef9c).

~/Projects/web-next/services/consumer-web-next master ⇣
» av stack tree

  * NVG-1070_chase_web_next_add_is_card_payment_to_query
  │ https://github.com/doordash/web-next/pull/28303     
  │                                                     
  │ * NVG-1076_chase_checkout_fix_country_code_bug      
  │ │ https://github.com/doordash/web-next/pull/29805   
  │ │                                                   
  │ │ * NVG-1077_chase_m1_analytics                     
  │ │ │ https://github.com/doordash/web-next/pull/29973 
  ├─┴─┘                                                 
  * master (HEAD)                                       

~/Projects/web-next/services/consumer-web-next master ⇣
» av stack sync --rebase-to-trunk --all

  ⢿ Restacking NVG-1076_chase_checkout_fix_country_code_bug...                                                                 

    * NVG-1070_chase_web_next_add_is_card_payment_to_query cd40584                                                             
    │                                                                                                                          
    │ * ⢿ NVG-1076_chase_checkout_fix_country_code_bug                                                                         
    │ │                                                                                                                        
    │ │ * NVG-1077_chase_m1_analytics (merged) 9b81688                                                                         
    ├─┴─┘                                                                                                                      
    * master 5eead22                                                                                                           

  Rebase conflict while rebasing  NVG-1076_chase_checkout_fix_country_code_bug                                                 
  Failed to rebase "refs/heads/NVG-1076_chase_checkout_fix_country_code_bug" onto "refs/heads/master" (merge base is "3d2d108")

  fatal: no such branch/commit 'NVG-1076_chase_checkout_fix_country_code_bug'                                                  

  Resolve the conflicts and continue the restack with av stack sync --continue                                                 

~/Projects/web-next/services/consumer-web-next master ⇣
» git status                                                       
On branch master
Your branch is behind 'origin/master' by 1282 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean

~/Projects/web-next/services/consumer-web-next master ⇣
» av stack tidy

  ✓ Updated the branch metadata for the deleted branches 

    Following branches no longer exist in the repository:

    * NVG-1076_chase_checkout_fix_country_code_bug       

~/Projects/web-next/services/consumer-web-next master ⇣
» av stack sync --rebase-to-trunk --all         
WARN[0000] unexpected output from git rebase with non-zero exit code (assuming rebase had conflicts): fatal: no such branch/commit 'NVG-1076_chase_checkout_fix_country_code_bug'  exit_code=128

  ⢿ Restacking NVG-1076_chase_checkout_fix_country_code_bug...                                                                 

    * NVG-1070_chase_web_next_add_is_card_payment_to_query cd40584                                                             
    │                                                                                                                          
    │ * NVG-1077_chase_m1_analytics (merged) 9b81688                                                                           
    ├─┘                                                                                                                        
    * master 5eead22                                                                                                           

  Rebase conflict while rebasing  NVG-1076_chase_checkout_fix_country_code_bug                                                 
  Failed to rebase "refs/heads/NVG-1076_chase_checkout_fix_country_code_bug" onto "refs/heads/master" (merge base is "3d2d108")

  fatal: no such branch/commit 'NVG-1076_chase_checkout_fix_country_code_bug'                                                  

  Resolve the conflicts and continue the restack with av stack sync --continue                                                 

~/Projects/web-next/services/consumer-web-next master ⇣
» git status 
On branch master
Your branch is behind 'origin/master' by 1282 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean

i deleted with git branch -D and then ran av st tidy but i still cant remove the info about the branch when i stack sync

hakanalpaydd commented 1 day ago

steps: git checkout master av stack branch whatever touch whatever git add -A && git commit -m whatever && av stack sync --push yes av pr create git checkout master git branch -D whatever av stack tidy av stack sync --rebase-to-trunk --all observe failure

after adopting a branch, if you delete it with av st tidy, it should "unadopt" it so that --all doesnt pick up an empty reference to a branch

jainankit commented 1 day ago

Hi @hakanalpaydd thanks for reporting the issue. I was not able to repro the issue based on the provided steps. I think this may only happen if you delete a branch from middle of a stack. Check out the documentation on folding a branch, that may be more relevant for this scenario: https://docs.aviator.co/aviator-cli/how-to-guides/split-and-fold-pull-requests#fold-the-branches