单个分支的Git导出 [英] Git export of a single branch

查看:99
本文介绍了单个分支的Git导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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:

  1. 在某些共享位置"创建git init --bare存储库
  2. git remote add origin此位置到您当前的工作存储库中
  3. git push --force origin HEAD来自您的主分支机构
  4. 其他开发人员现在可以仅使用master分支来克隆该存储库
  1. Create git init --bare repository at some "shared location"
  2. git remote add origin this location to your current working repository
  3. git push --force origin HEAD from your master branch
  4. Other devs now can clone that repository with only master branch

这篇关于单个分支的Git导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆