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的更多相关文章

  1. 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 ...

  2. Git与Repo入门(转载)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAykAAADuCAIAAACyDd+sAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4Xu ...

  3. 【转】Git与Repo入门----不错

    原文网址:http://www.cnblogs.com/angeldevil/p/3238470.html Git与Repo入门   版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工 ...

  4. Git 和 Repo常用命令

    这篇博客总结的也不错: git常用及进阶命令总结 Git与Repo入门 一.初始環境配置 git config --global user.name "John Doe"git c ...

  5. 【转】Android源码学习(2)使用Git和Repo进行版本管理

    原文网址:http://blog.chinaunix.net/uid-26074270-id-2458828.html Android项目采用Git和Repo进行版本管理.在大多数情况下,Git都可以 ...

  6. Git Gerrit Repo User Manual

                      Git Repo Gerrit User Manual Revision History   Revision # Description Date Author ...

  7. Git和Repo管理使用简要介绍

    在Linux平台下进行Android系统项目开发时,需要Git或repo管理. 一. Git和Repo的区别: 1. Git:Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的 ...

  8. Git和Repo管理使用

    Git和Repo管理使用简要介绍 http://blog.csdn.net/stevenhu_223/article/details/8828130 多仓库代码管理器Repo的安装,使用以及服务器搭建 ...

  9. Git与Repo入门

    版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工程等的修改历史,方便查看更改历史,备份以便恢复以前的版本,多人协作... 一.原始版本控制 最原始的版本控制是纯手工的版本控制:修改文 ...

随机推荐

  1. PTA 11-散列1 电话聊天狂人 (25分)

    题目地址 https://pta.patest.cn/pta/test/15/exam/4/question/722 5-14 电话聊天狂人   (25分) 给定大量手机用户通话记录,找出其中通话次数 ...

  2. 在Python中建立N维数组并赋初值

    在Python中,由于不像C++/Java这样的语言可以方便的用a[i][j]=0的方式,建立二维数组并赋初值,所以需要一个相对巧妙的方法. 可以用列表解析的方式,eg: >>> m ...

  3. 【bzoj4260】Codechef REBXOR Trie树

    题目描述 输入 输入数据的第一行包含一个整数N,表示数组中的元素个数. 第二行包含N个整数A1,A2,…,AN. 输出 输出一行包含给定表达式可能的最大值. 样例输入 5 1 2 3 1 2 样例输出 ...

  4. 解决在IE6、7中用height来设定SELECT标签高度无效的兼容性问题

    在IE6.7中用height来设定SELECT标签高度是无效的,宽度的话各浏览器设置都是一致的,解决方法就是在select外嵌套两层标签,一层用来遮挡select的默认边框(在IE6.7中设置bord ...

  5. BZOJ 4555 [Tjoi2016&Heoi2016]求和 ——分治 NTT 多项式求逆

    不想多说了,看网上的题解吧,我大概说下思路. 首先考察Stirling的意义,然后求出递推式,变成卷积的形式. 然后发现贡献是一定的,我们可以分治+NTT. 也可以直接求逆(我不会啊啊啊啊啊) #in ...

  6. hosts文件位置

    windows C:\WINDOWS\system32\drivers\etc mac /etc/hosts 修改hosts文件会遇到无法保存的问题,解法方法参考下文 http://mtoou.inf ...

  7. 相关分析 BZOJ 4821

    相关分析 [问题描述] Frank对天文学非常感兴趣,他经常用望远镜看星星,同时记录下它们的信息,比如亮度.颜色等等,进而估算出星星的距离,半径等等.Frank不仅喜欢观测,还喜欢分析观测到的数据.他 ...

  8. C#精髓第四讲 GridView 72般绝技

    原文发布时间为:2008-08-03 -- 来源于本人的百度文章 [由搬家工具导入] 原文地址:http://blog.csdn.net/21aspnet/archive/2007/03/25/154 ...

  9. ubuntu登入死循环问题 解决!!

    把/etc/environment文件中的 PATH="/usr/local//sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games" ...

  10. linux shmget shmctl

    shmgetint shmget(key_t key, size_t size, int flag);key: 标识符的规则size:共享存储段的字节数flag:读写的权限返回值:成功返回共享存储的i ...