单个分支的Git导出 [英] Git export of a single branch
问题描述
我在git存储库中本地工作.它具有各种分支,例如dev分支,一些用于实验更改的分支等等.当然还有一个主分支.
I worked locally on a git repository. It has various branches like a dev branch, some branch for experimental changes and so on. And of course a master branch.
我想建立一个公共(当然,这是很简单的事情,最好说共享")存储库,使其仅包含master分支.
I want to setup a public (well, indeed it's a lan thing, better say "shared") repository to only contain the master branch.
如何导出该分支,以便可以将其复制到目标文件夹?谢谢
How to export that branch so that i can copy it to the destination folder? Thanks
推荐答案
作为 git-push手册说:
git push origin HEAD:master
将当前分支推送到远程 ref匹配原点中的master 资料库.这种形式很方便 推送当前分支而不 考虑它的本地名称.
Push the current branch to the remote ref matching master in the origin repository. This form is convenient to push the current branch without thinking about its local name.
或
git push origin HEAD
一种方便的方法,可将当前分支推到遥控器上的相同名称.
A handy way to push the current branch to the same name on the remote.
使用这些命令,您可以执行以下操作:
Using these commands you do:
- 在某些共享位置"创建
git init --bare
存储库 -
git remote add origin
此位置到您当前的工作存储库中 -
git push --force origin HEAD
来自您的主分支机构 - 其他开发人员现在可以仅使用master分支来克隆该存储库
- Create
git init --bare
repository at some "shared location" git remote add origin
this location to your current working repositorygit push --force origin HEAD
from your master branch- Other devs now can clone that repository with only master branch
这篇关于单个分支的Git导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!