(command.CommandList
  children: [
    (command.Sentence
      child: 
        (command.AndOr
          ops: [Id.Op_DPipe]
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GIT_DIR)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:17)
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(rev-parse)} {(-q)} {(--git-dir)})]
                          )
                      )
                    }
                  spids: [16]
                )
              ]
            )
            (C {(Id.Lit_Other ':')})
          ]
        )
      terminator: (Token id:Id.Op_Semi val:';' span_id:30)
    )
    (command.ShFunction
      name: get_default_remote
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:curr_branch)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:42)
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                          )
                      )
                    }
                  spids: [41]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:curr_branch)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (braced_var_sub
                          token: (Token id:Id.VSub_Name val:curr_branch span_id:56)
                          suffix_op: 
                            (suffix_op.Unary
                              op_id: Id.VOp1_Pound
                              arg_word: {(refs) (Id.Lit_Slash /) (heads) (Id.Lit_Slash /)}
                            )
                        )
                      )
                    }
                  spids: [53]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:origin)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:67)
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(git)} {(config)} {(--get)} 
                                {(DQ (branch.) ($ Id.VSub_DollarName '$curr_branch') (.remote))}
                              )
                            ]
                          )
                      )
                    }
                  spids: [66]
                )
              ]
            )
            (C {(echo)} 
              {
                (braced_var_sub
                  token: (Token id:Id.VSub_Name val:origin span_id:85)
                  suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(origin)})
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: get_remote_merge_branch
      body: 
        (command.BraceGroup
          children: [
            (command.Case
              to_match: {(DQ ($ Id.VSub_Pound '$#'))}
              arms: [
                (case_arm
                  pat_list: [{(0)} {(1)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:origin)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_Number '$1'))}
                          spids: [116]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:default)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:123)
                                command_list: 
                                  (command.CommandList
                                    children: [(C {(get_default_remote)})]
                                  )
                              )
                            }
                          spids: [122]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$origin'))})
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:origin)
                              op: assign_op.Equal
                              rhs: {($ Id.VSub_DollarName '$default')}
                              spids: [138]
                            )
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DAmp Id.Op_DAmp]
                      children: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:curr_branch)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (command_sub
                                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:143)
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                                      )
                                  )
                                }
                              spids: [142]
                            )
                          ]
                        )
                        (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$origin'))} 
                          {(Id.Lit_Equals '=')} {(DQ ($ Id.VSub_DollarName '$default'))} {(Id.Lit_RBracket ']')}
                        )
                        (C {(echo)} 
                          {
                            (command_sub
                              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:175)
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (C {(git)} {(for-each-ref)} 
                                      {(--format) (Id.Lit_Equals '=') 
                                        (SQ (Token id:Id.Lit_Chars val:'%(upstream)' span_id:183))
                                      } {($ Id.VSub_DollarName '$curr_branch')}
                                    )
                                  ]
                                )
                            )
                          }
                        )
                      ]
                    )
                  ]
                  spids: [110 113 190 -1]
                )
                (case_arm
                  pat_list: [{(Id.Lit_Star '*')}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:repo)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_Number '$1')}
                          spids: [197]
                        )
                      ]
                    )
                    (C {(shift)})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:ref)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_Number '$1')}
                          spids: [204]
                        )
                      ]
                    )
                    (command.Case
                      to_match: {(DQ ($ Id.VSub_DollarName '$ref'))}
                      arms: [
                        (case_arm
                          pat_list: [{(Id.Lit_Other '+') (Id.Lit_Star '*')}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:ref)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (command_sub
                                        left_token: 
                                          (Token
                                            id: Id.Left_DollarParen
                                            val: '$('
                                            span_id: 231
                                          )
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (C {(expr)} {(DQ (z) ($ Id.VSub_DollarName '$ref'))} 
                                                {(Id.Lit_Other ':')} {(SQ (Token id:Id.Lit_Chars val:'z+\\(.*\\)' span_id:242))}
                                              )
                                            ]
                                          )
                                      )
                                    }
                                  spids: [230]
                                )
                              ]
                            )
                          ]
                          spids: [225 227 247 -1]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.Simple
                          words: [
                            {(expr)}
                            {(DQ (z) ($ Id.VSub_DollarName '$ref'))}
                            {(Id.Lit_Other ':')}
                            {(SQ (Token id:Id.Lit_Chars val:'z.*:' span_id:263))}
                          ]
                          redirects: [
                            (redir.Redir
                              op: (Token id:Id.Redir_Great val:'>' span_id:266)
                              fd: -1
                              arg_word: {(/dev/null)}
                            )
                          ]
                        )
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:ref)
                              op: assign_op.Equal
                              rhs: {(DQ (${ Id.VSub_Name ref) (':'))}
                              spids: [271]
                            )
                          ]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:remote)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:281)
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(expr)} {(DQ (z) ($ Id.VSub_DollarName '$ref'))} 
                                        {(Id.Lit_Other ':')} {(SQ (Token id:Id.Lit_Chars val:'z\\([^:]*\\):' span_id:292))}
                                      )
                                    ]
                                  )
                              )
                            }
                          spids: [280]
                        )
                      ]
                    )
                    (command.Case
                      to_match: {(DQ ($ Id.VSub_DollarName '$remote'))}
                      arms: [
                        (case_arm
                          pat_list: [{(SQ )} {(HEAD)}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:remote)
                                  op: assign_op.Equal
                                  rhs: {(HEAD)}
                                  spids: [315]
                                )
                              ]
                            )
                          ]
                          spids: [306 313 318 -1]
                        )
                        (case_arm
                          pat_list: [{(heads/) (Id.Lit_Star '*')}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:remote)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (braced_var_sub
                                        token: (Token id:Id.VSub_Name val:remote span_id:327)
                                        suffix_op: 
                                          (suffix_op.Unary
                                            op_id: Id.VOp1_Pound
                                            arg_word: {(heads) (Id.Lit_Slash /)}
                                          )
                                      )
                                    }
                                  spids: [325]
                                )
                              ]
                            )
                          ]
                          spids: [321 323 333 -1]
                        )
                        (case_arm
                          pat_list: [{(refs/heads/) (Id.Lit_Star '*')}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:remote)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (braced_var_sub
                                        token: (Token id:Id.VSub_Name val:remote span_id:342)
                                        suffix_op: 
                                          (suffix_op.Unary
                                            op_id: Id.VOp1_Pound
                                            arg_word: 
                                              {(refs) (Id.Lit_Slash /) (heads) (Id.Lit_Slash /)}
                                          )
                                      )
                                    }
                                  spids: [340]
                                )
                              ]
                            )
                          ]
                          spids: [336 338 350 -1]
                        )
                        (case_arm
                          pat_list: [
                            {(refs/) (Id.Lit_Star '*')}
                            {(tags/) (Id.Lit_Star '*')}
                            {(remotes/) (Id.Lit_Star '*')}
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:remote)
                                  op: assign_op.Equal
                                  rhs: (word.Empty)
                                  spids: [368]
                                )
                              ]
                            )
                          ]
                          spids: [353 366 -1 371]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {(Id.Lit_LBracket '[')} {(-n)} {(DQ ($ Id.VSub_DollarName '$remote'))} 
                          {(Id.Lit_RBracket ']')}
                        )
                        (command.Case
                          to_match: {(DQ ($ Id.VSub_DollarName '$repo'))}
                          arms: [
                            (case_arm
                              pat_list: [{(.)}]
                              action: [
                                (C {(echo)} {(DQ (refs/heads/) ($ Id.VSub_DollarName '$remote'))})
                              ]
                              spids: [395 396 407 -1]
                            )
                            (case_arm
                              pat_list: [{(Id.Lit_Star '*')}]
                              action: [
                                (C {(echo)} 
                                  {
                                    (DQ (refs/remotes/) ($ Id.VSub_DollarName '$repo') (/) 
                                      ($ Id.VSub_DollarName '$remote')
                                    )
                                  }
                                )
                              ]
                              spids: [410 411 424 -1]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                  spids: [193 194 -1 430]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: error_on_missing_default_upstream
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:cmd)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [443]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:op_type)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$2'))}
                  spids: [449]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:op_prep)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$3'))}
                  spids: [455]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:example)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$4'))}
                  spids: [464]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:branch_name)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:471)
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                          )
                      )
                    }
                  spids: [470]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:display_branch_name)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (braced_var_sub
                          token: (Token id:Id.VSub_Name val:branch_name span_id:485)
                          suffix_op: 
                            (suffix_op.Unary
                              op_id: Id.VOp1_Pound
                              arg_word: {(refs) (Id.Lit_Slash /) (heads) (Id.Lit_Slash /)}
                            )
                        )
                      )
                    }
                  spids: [482]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:remote)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:501)
                          command_list: 
                            (command.CommandList
                              children: [(C {(gettext)} {(DQ ('<remote>'))})]
                            )
                        )
                      )
                    }
                  spids: [499]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:branch)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:513)
                          command_list: 
                            (command.CommandList
                              children: [(C {(gettext)} {(DQ ('<branch>'))})]
                            )
                        )
                      )
                    }
                  spids: [511]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(test)} 
                      {
                        (command_sub
                          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:527)
                          command_list: 
                            (command.CommandList
                              children: [
                                (command.Pipeline
                                  children: [(C {(git)} {(remote)}) (C {(wc)} {(-l)})]
                                  negated: F
                                )
                              ]
                            )
                        )
                      } {(Id.Lit_Equals '=')} {(1)}
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:remote)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:548)
                                command_list: (command.CommandList children:[(C {(git)} {(remote)})])
                              )
                            }
                          spids: [547]
                        )
                      ]
                    )
                  ]
                  spids: [523 544]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$branch_name'))})]
                  action: [(C {(gettextln)} {(DQ ('You are not currently on a branch.'))})]
                  spids: [559 570]
                )
              ]
              else_action: [
                (C {(gettextln)} {(DQ ('There is no tracking information for the current branch.'))})
              ]
            )
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName '$op_type'))}
              arms: [
                (case_arm
                  pat_list: [{(rebase)}]
                  action: [
                    (C {(gettextln)} {(DQ ('Please specify which branch you want to rebase against.'))})
                  ]
                  spids: [602 603 613 -1]
                )
                (case_arm
                  pat_list: [{(merge)}]
                  action: [
                    (C {(gettextln)} {(DQ ('Please specify which branch you want to merge with.'))})
                  ]
                  spids: [616 617 627 -1]
                )
                (case_arm
                  pat_list: [{(Id.Lit_Star '*')}]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {(DQ ('BUG: unknown operation type: ') ($ Id.VSub_DollarName '$op_type'))}
                      ]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:636)
                          fd: -1
                          arg_word: {(2)}
                        )
                      ]
                    )
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:645)
                      arg_word: {(1)}
                    )
                  ]
                  spids: [630 631 650 -1]
                )
              ]
            )
            (C {(eval_gettextln)} 
              {
                (DQ ('See git-') 
                  (word_part.EscapedLiteral
                    token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:660)
                  ) ('{cmd}(1) for details.')
                )
              }
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('    ') ($ Id.VSub_DollarName '$example'))})
            (C {(echo)})
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$branch_name'))})]
                  action: [
                    (C {(gettextln)} 
                      {
                        (DQ 
                          (
'If you wish to set tracking information for this branch you can do so with:'
                          )
                        )
                      }
                    )
                    (C {(echo)})
                    (C {(echo)} 
                      {
                        (DQ ('    git branch --set-upstream-to=') ($ Id.VSub_DollarName '$remote') (/) 
                          ($ Id.VSub_DollarName '$branch') (' ') ($ Id.VSub_DollarName '$display_branch_name')
                        )
                      }
                    )
                    (C {(echo)})
                  ]
                  spids: [679 690]
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:721)
              arg_word: {(1)}
            )
          ]
        )
    )
  ]
)