Search code examples
gitgithubbranchwiki

fetch branches in a github wiki


Since GitHub wikis are git repositories unto themselves, it should follow that one could create branches. Even GH suggests in there documentation that this is possible.

I've done this with my wiki and pushed it up to GH. But when I pull the repo, it only pulls the master branch, and I can't see any others.

Is there a way that I can access the other branches?

Edit 1

  • I know that the wiki is a separate repo. That's what I'm trying to pull.
  • I tried cloning it to a different folder, and only the master branch is fetched.

Solution

  • The wiki of your repository is stored as a different repository.
    GitHub displays it under your project.

    How to clone a Wiki GitHub repo?

    # Clones the wiki locally
    git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
    
    # or using ssh
    git clone git@github.com:YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
    

    List all branches

    You can use git branch -a which will display all your branches both local and remotes and now you will be able to checkout any existing branch.

    # list all local and remote branches
    git branch -a
    
    # checkout any required branch
    git checkout <branch name>