Adopt a Branch
Aviator CLI needs to maintain the metadata for branches so that it can remember the parent-child relationships among them. If you create branches with
av stack branch
, the metadata is created upon branch creation. You can attach the metadata for branches that are created with git branch
.We will use an example repository from https://github.com/octocat/hello-world. Clone it and initialize the Aviator CLI.
$ git clone https://github.com/octocat/hello-world
Cloning into 'hello-world'...
remote: Enumerating objects: 13, done.
remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13
Receiving objects: 100% (13/13), done.
$ cd hello-world
$ av init
Successfully initialized repository for use with av!
Instead of using
av stack branch
, we use a normal Git command to create a branch and a commit.$ git switch --create mytopic
Switched to a new branch 'mytopic'
$ git commit --allow-empty --message="New commit"
[mytopic d384683] New commit
As we can see, the newly created branch
mytopic
is not tracked in av stack tree
, but it's shown in git branch
.$ av stack tree
master
$ git branch -vv
master 7fd1a60 [origin/master] Merge pull request #6 from Spaceghost/patch-1
* mytopic d384683 New commit
By running
av stack sync
specifying the parent branch (in this case master
) adds metadata for the current branch mytopic
. Now, if you run av stack tree
, you can see that mytopic
is correctly recognized as a child of master
.$ av stack sync --parent master
- Adopting a branch mytopic to Av
- Re-parenting branch mytopic onto master
Synchronizing branch mytopic...
- fetching latest pull request information for mytopic
- this branch does not have an open pull request (create one with av pr create or av stack submit)
- branch is a stack root, nothing to do (run av stack sync --trunk to sync against the latest commit in master)
$ av stack tree
master
* mytopic (not pushed)
Last modified 3mo ago