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入门
版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工程等的修改历史,方便查看更改历史,备份以便恢复以前的版本,多人协作... 一.原始版本控制 最原始的版本控制是纯手工的版本控制:修改文 ...
随机推荐
- POJ 1145 Tree Summing
Tree Summing Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7698 Accepted: 1737 Desc ...
- div固定在屏幕底部
项目中需要实现div一直显示在屏幕的底部,不管页面有多长或者多端都需要满足. 在网上找的用js实现的,移动时会闪动,效果不是特别好.也可能是没找到好的. 相比js,我更希望使用css实现 1 < ...
- TensorFlow开发流程 Windows下PyCharm开发+Linux服务器运行的解决方案
不知道是否有许多童鞋像我一样,刚开始接触TensorFlow或者其他的深度学习框架,一时间有一种手足无措的感觉. 怎么写代码?本机和服务器的关系是啥?需要在本机提前运行吗?怎么保证写的代码是对的??? ...
- NOJ——1627Alex’s Game(II)(尺取)
[1627] Alex’s Game(II) 时间限制: 2000 ms 内存限制: 65535 K 问题描述 Alex likes to play with one and zero as you ...
- APIO2018 题解
坑了好久,补一补. 话说我当时去参加 $APIO2018$ 了,不过纯粹打铁…… 我的程序交道人家毛子的网站上, $c++14$ 编译器不停地给我编 $RE$,只记得好像是结构体排序的问题(删掉那个排 ...
- java中String初始化的两种方式
转自:http://www.diybl.com/course/3_program/java/javajs/2007104/75886.html 字符串可能是任何程序语言中都会出现的对象,j ...
- 使用UltraEdit 替换解决---文字中含有逗号的文件,如何把逗号自动转换成为:回车换行呢?
实际工作中有时经常遇到一个问题: 一行文字中含有逗号,如何把逗号自动转换成为:回车换行呢? 普遍存在的问题,用Ultredit中^r^n(回车换行)也可以完成.提供大家参考. 王乐,李宏宇,张志鹏,刘 ...
- 为什么linux下多线程程序如此消耗虚拟内存【转】
转自:http://blog.csdn.net/chen19870707/article/details/43202679 权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 探 ...
- CodeForces 380.C Sereja and Brackets
题意 一串括号序列,只由(和)组成,然后是m个提问,提问l和r区间内,最大的匹配匹配括号数. 思路 第一,贪心的思想,用最正常的方式去尽量匹配,详细点说就是,先找到所有的(),然后删除这些(),再找所 ...
- Image与Base64String的互转换
public Image Base64ToImage(string base64String) { // Convert Base64 String to byte[] byte[] imageByt ...