Skip to content

branches

브랜치를 순회하는 반복자를 만들어요.

시그니처

ts
class Repository {
  branches(filter?: BranchesFilter | null | undefined): Branches;
}

파라미터

  • filternull | BranchesFilter

    브랜치 반복자를 위한 필터에요.

    • typeBranchType

      필터할 브랜치 유형이에요.

      - Local : 원격에 없는 로컬 브랜치에요.
      - Remote : 원격 브랜치에요.

반환 값

  • Branches

    브랜치를 순회하는 반복자

예제

ts
import { openRepository } from 'es-git';

const repo = await openRepository('/path/to/repo');

for (const branch of repo.branches()) {
  console.log(branch.type); // "Local"
  console.log(branch.name); // "main"
}

MIT 라이선스에 따라 배포됩니다.