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

Q: how to escape / reset from incorrect state? #490

Open
kwonoj opened this issue Dec 13, 2024 · 1 comment
Open

Q: how to escape / reset from incorrect state? #490

kwonoj opened this issue Dec 13, 2024 · 1 comment

Comments

@kwonoj
Copy link

kwonoj commented Dec 13, 2024

I deleted one of branch which is a parent of other branches, and then av sync gets an error for any sync / other command like

 ⣽ Restacking branch-xyz...
                                                   
    * ⣽ branch-others
    │                                              
    * brancy-xyz      
    │                                              
    * master 2c48375                               
                                                   
                                                   
error: failed to get branch "refs/heads/branch-xyz": reference not found

I ended up deleting .git/av and re-init, curious if there's way to escape, reset the error state.

@jainankit
Copy link
Contributor

It depends - do you care about the commits of the branch that you deleted?
Let's say you have three branches (A, B, C) with corresponding commits A1, B1, C1.

master <- A1 <- B1 <- C1

Now if you delete branch A, then B and C will be orphaned (although it might show up in the tree along with the deleted branch.

Option 1

At this point, if you want to also delete the commits associated with branch A (commit A1 in this case), then you can simply reparent B:

git checkout B
av reparent --parent master

That way, your tree would look like:

master <- B1 <- C1

Option 2

But if you want both A1 and B1 to be included as part of the new branch B, you can run tidy first:

av tidy

This will remove B and C from the stack entirely, but leave the branches locally. Then you can adopt B and C manually:

git checkout B
av adopt --parent master
git checkout C
av adopt --parent B

With this, your tree will remain the same:

master <- A1 <- B1 <- C1

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

No branches or pull requests

2 participants