---
# System prepended metadata

title: Untitled

---



Push logic:

```
@unison/base:main> project.push [project:branch]
```

If not on a branch, bail.

Resolve where to push:
- If project/branch names provided
  - If project_id/branch_id in remote_project/remote_project_branch tables
    - goto 1 (project_id branch_id)
  - else
    - if the ids exist on Share
      - goto 1 (project_id branch_id)
    - else
      - create them on Share
      - goto 2
- Else project/branch names not provided
    - If default push project_id exists
        - If default push branch_id exists
            - Goto 1
        - Else default push branch_id doesn't exist
            - If this branch name exists under the default project_id
                - goto 1 (project_id, branch_id)
            - Else
                - create the branch on Share
                - Goto 2
    - Else default push location doesn't exist
        - Get my username
        - Do all the logic with the 

label 1:
Now we have remote (project_id, branch_id)

label 2:


  --   else if (default push location exists),
  --     if (its remote branch id is non-null)
  --       use that
  --     else
  --       if (this branch name exists in that project)
  --         use that
  --       else
  --         create a branch with this name 
  --   else
  --     ask Share for my username
  --     if (I'm not logged in)
  --       fail -- don't know where to push
  --     else
