repo.txt 948 B

123456789101112131415161718192021222324252627282930
  1. .. _tutorial-repo:
  2. The Repository
  3. ==============
  4. After this introduction, let's start directly with code::
  5. >>> from dulwich.repo import Repo
  6. The access to a repository is through the Repo object. You can open an
  7. existing repository or you can create a new one. There are two types of Git
  8. repositories:
  9. Regular Repositories -- They are the ones you create using ``git init`` and
  10. you daily use. They contain a ``.git`` folder.
  11. Bare Repositories -- There is not ".git" folder. The top-level folder
  12. contains itself the "branches", "hooks"... folders. These are used for
  13. published repositories (mirrors). They do not have a working tree.
  14. Let's create a folder and turn it into a repository, like ``git init`` would::
  15. >>> from os import mkdir
  16. >>> mkdir("myrepo")
  17. >>> repo = Repo.init("myrepo")
  18. >>> repo
  19. <Repo at 'myrepo'>
  20. You can already look a the structure of the "myrepo/.git" folder, though it
  21. is mostly empty for now.