Git bare repo with multiple branches
http://stackoverflow.com/questions/9324762/git-bare-repo-with-multiple-branches
Q:
I want to make a git bare repository with multiple branches (master, develop, release, etc..).
So question is if it is possible to checkout the bare repository or how to switch among the branches (does it make a sense to switch)?
When I want to push to the bare repository can I make a merging on bare repository or merging must be done locally and push the adequate branch?So looking for a right approach :-)
Thanks Peter
A:
I want to make a git bare repository with multiple branches (master, develop, release, etc..).
Judging from the question, it seems that you are unsure of the reasons you would make a bare git repository, and how you would use said repository. The question is, why do you wish to make a bare repository?
From Pro Git, a bare repository is "a repository that doesn’t contain a working directory." It's a repository that you don't work out of, and is just used to git push
and git pull
from. The reason for this is summed up here:
"A bare repository is one without a checked out working copy of the code. It only contains the git database. As a general rule you should never push into a repository that contains changes in the working copy. To ensure this doesn't happen, we're making the server repository a bare repository - it has no working copy."
So, a bare git repository can definitely contain multiple branches. You can definitely fetch a copy of the bare remote repository into your local repository, and push from your local repository to your remote (bare) repository. However, you don't want to work out of your bare repository. (Furthermore, it is impossible to run git add
whilst in a bare repository; see this SO question for clarification).
So question is if it is possible to checkout the bare repository or how to switch among the branches (does it make a sense to switch)?
This question, I think, is not entirely clear, because you never really switch branches on the bare repository - you never work on the bare repository. All you do is push or pull from it.
When I want to push to the bare repository can I make a merging on bare repository or merging must be done locally and push the adequate branch? So looking for a right approach :-)
To git-push
to a bare repository, you must first ensure that there is no merge conflict - if there is, the push will fail (Reference: book.git-scm.com, "Pushing changes to a public repository"). Merging must therefore be done locally, and then changes fast-forwarded on the bare repository with git-push
.
So looking for a right approach.
There isn't anything special about a bare repository, aside from the fact that you should not and can not work out of it. As others have referenced, the gitflow model gives you an idea of a workflow involving several repositories - there are lots of questions on SO asking for git workflow examples and methodologies. Almost every reference (1, Pro Git), (2, book.git-scm.com) uses a bare repository in conjunction with a public or published repository - the linked articles discuss creation and use of bare repositories in detail.
Git bare repo with multiple branches的更多相关文章
- How to get started with GIT and work with GIT Remote Repo
https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1. Introduction GIT is a ...
- Git与Repo入门(转载)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAykAAADuCAIAAACyDd+sAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4Xu ...
- 【转】Git与Repo入门----不错
原文网址:http://www.cnblogs.com/angeldevil/p/3238470.html Git与Repo入门 版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工 ...
- Git 和 Repo常用命令
这篇博客总结的也不错: git常用及进阶命令总结 Git与Repo入门 一.初始環境配置 git config --global user.name "John Doe"git c ...
- 【转】Android源码学习(2)使用Git和Repo进行版本管理
原文网址:http://blog.chinaunix.net/uid-26074270-id-2458828.html Android项目采用Git和Repo进行版本管理.在大多数情况下,Git都可以 ...
- Git Gerrit Repo User Manual
Git Repo Gerrit User Manual Revision History Revision # Description Date Author ...
- Git和Repo管理使用简要介绍
在Linux平台下进行Android系统项目开发时,需要Git或repo管理. 一. Git和Repo的区别: 1. Git:Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的 ...
- Git和Repo管理使用
Git和Repo管理使用简要介绍 http://blog.csdn.net/stevenhu_223/article/details/8828130 多仓库代码管理器Repo的安装,使用以及服务器搭建 ...
- Git与Repo入门
版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工程等的修改历史,方便查看更改历史,备份以便恢复以前的版本,多人协作... 一.原始版本控制 最原始的版本控制是纯手工的版本控制:修改文 ...
随机推荐
- Git只获取部分目录的内容
Git只获取部分目录的内容 Git的克隆,默认是直接拉取整个远程仓库,如果项目比较大,大量和自己无关的内容也会拉到本地,占用很多硬盘空间.Git在1.7版本后,已经支持只Checkout部分内容,这个 ...
- mybatis学习(九)——动态sql
MyBatis 的强大特性之一便是它的动态 SQL.可以根据不同条件拼接 SQL 语句. 动态 SQL 元素和使用 JSTL 或其他类似基于 XML 的文本处理器相似.主要由以下几种元素. if wh ...
- Static相关
[理解] 说到static,脑中浮现的几个Key Words是什么? main 类 唯一空间 所有对象共享 static只能处理static 很好,解释一下上面的意思: main static fie ...
- DataTable.AcceptChanges的理解
OleDbDataAdapter 怎么更新不了数据库? String tbName = ds.Tables[0].TableName; String te ...
- AC日记——Andryusha and Socks Codeforces 780a
A. Andryusha and Socks time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- 微信小程序 使用微信支付功能实现在线订单支付
以前做过PC页面微信支付,但是这次在小程序 直接调用微信支付功能还是方便很多 先放个微信官方API链接:https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_a ...
- 微信小程序踩坑之一[wx.request]请求模式
最近在做小程序时,使用wx.request()方法请求时, 当使传输string类型时,一定要声明method请求模式为post,否则会一直报错,而不声明时默认为get, 已填坑 =,= wx.req ...
- Codeforces Gym 100338B Spam Filter 字符串哈希+贝叶斯公式
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-an ...
- Ubuntu 16.04安装Wine版的迅雷+QQ(完美方案,终极解决方法)
安装前先备份好系统! 继上一篇安装QQ的方法http://www.cnblogs.com/EasonJim/p/7425978.html,这一篇的QQ采用的是Wine模式安装.完美解决消息记录中文乱码 ...
- javascript 对象初探 (六)--- call()和apply()初探
在javascript中,每个函数都具有call()和apply()两个方法,您可以用她们来触发函数,并指定相关的调用参数. 此外,这两个方法还有另一个功能,就是她可以让一个对象去‘借用‘另一个对象的 ...