Git Hub Clone All Branches At Once

后端 未结 7 1073
时光取名叫无心
时光取名叫无心 2020-12-07 12:19

I\'m trying to clone an entire repository onto my machine using linux. I used

git clone    

I then went into the folder where i

7条回答
  •  眼角桃花
    2020-12-07 12:39

    To download a full repository, including all branches, use the following command: git clone --mirror

    This will create a folder called repository.git unless you give it a different name.

    Now, this gets you a full clone of the original repository, but because it's in bare=true mode, you don't have a work tree. Effectively, what you have is the .git folder, including all branches and content. This is a fancy way of saying that you won't have direct access to the files because they're stashed away within the git system (compressed, etc).

    To make this a "normal" git repo, we need to make this clone the .git folder within a new folder, which will be our usual repo folder:

    mkdir mv repository.git /.git cd git checkout master

    Note that there is no single native git command to download all remote branches, so the simplest way is to make sure you have all commits pushed to the origin, and then re-download the whole repository anew using this --mirror option.

提交回复
热议问题