BitBucket-直接添加到开发分支而不是master [英] BitBucket - Add to develop branch directly instead of master

查看:507
本文介绍了BitBucket-直接添加到开发分支而不是master的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将SCM更改为BitBucket.当前,我们使用Clearcase SCM,并且在不同的阶段/流中都有代码-开发,UAT和生产,其中开发人员具有开发人员当前正在开发的代码,UAT已完成由BP测试的更改,生产具有已部署到生产中的代码

We are in the process of changing our SCM to BitBucket. Currently we use Clearcase SCM and there we have code in different stages / streams - Dev, UAT and production, where dev has code that developers are currently working on, UAT has completed changes being tested by BPs and Production has code that is deployed to production.

在BitBucket中,我们的管理员定义了3个分支:开发,测试和掌握.

In BitBucket, our admins have defined 3 branches: develop, test and master.

对于我们的一个应用程序,在CC中,我们在每个状态下都有代码,因此我试图从dev流中添加代码以在BitBucket中开发分支.

For one of our applications, in CC, we have code in each of the states, so I was trying to add code from dev stream to develop branch in BitBucket.

我正在使用全新创建的存储库.存储库中的所有分支都有一个README.TXT文件.

I am using a brand new created repo. All the branches in the repo have a README.TXT file.

我正在使用的命令是

# 1.    create a Project & Repo in Bitbucket named __apprepo_
# 2.    create a Snapshot view on your workstation from Clearcase for the application that you want to migrate
# 3.    at the DOS command line, change directory to the root of your snapshot view
# 4.    type ‘git init’
# 5.    type ‘git add --all’
# 6.    type ‘git commit –m "Initial Commit" ‘
# 7.    type ‘git remote add origin ssh://ourBBserver.com:7999/EN/apprepo
# 8.    type ‘remote –v’
# 9.    type ‘git pull origin develop’
# 10.   type ‘git push –u origin develop’

当我运行#9时,出现以下错误:

When i run #9, I get the following error :

error   22-Jul-2016 20:45:10    warning: no common commits
error   22-Jul-2016 20:45:10    From ssh://ourBBserver.com:7999/EN/apprepo
error   22-Jul-2016 20:45:10     * branch            develop    -> FETCH_HEAD
error   22-Jul-2016 20:45:10     * [new branch]      develop    -> origin/develop
error   22-Jul-2016 20:45:10    error: src refspec develop does not match any.
error   22-Jul-2016 20:45:10    error: failed to push some refs to 'ssh://ourBBserver.com:7999/EN/apprepo.git'

但是对于#9和#10,如果我将develop更改为master,它将起作用.

But for #9 and #10, if I change develop to master, it works.

如何将代码直接移动到develop分支?和test分支

what can I do to move the code to develop branch directly? And same with test branch

推荐答案

您无需切换到ClearCase视图并在那里初始化存储库.

You don't need to switch to a ClearCase view and initialize your repo there.

将本地Git仓库分开存放,准备推送到其远程仓库.

Keep your local Git repo separate, ready to push to its remote repo.

每次您想从ClearCase中添加一个相干状态时,请留在git repo中并输入:

Each time you want to add a coherent state from ClearCase, stay in your git repo and type:

 git --work-tree=/path/to/ClearCase/view/aVob add .
 git commit -m "Add state from CC view"
 git push

然后将CC视图的配置规范更改为其下一个基线(或完整标签),以表示下一个一致状态(因为ClearCase基于文件,并且在UCM基线旁边没有提交的概念).
并将相同视图的新内容再次添加到您相同的本地Git存储库(相同的分支)中.并再次推动.

Then change the config spec of the CC view to its next baseline (or full label), in order to represent the next coherent state (since ClearCase is file-based, and has no notion of commits beside an UCM baseline).
And add again the new content of that same view to your same local Git repo (same branch). And push again.

我的基本问题是-如果我要添加到develop分支而不是master分支的文件集,并且执行了'git init'->'git add --all'->' git commit –m初始提交"'->'git remote add origin ssh://ourBBserver.com:7999/EN/apprepo',

My basic question is - If I have set of files that I want to add to develop branch instead of master branch and I did a ‘git init’ -> ‘git add --all’ -> ‘git commit –m "Initial Commit" ‘ -> ‘git remote add origin ssh://ourBBserver.com:7999/EN/apprepo' ,

首先:不要git init.如果您有一个master分支,这意味着您已经已经在其他地方初始化了一个仓库.

First: don't git init. If you have a master branch that means you already initialize a repo somewhere else.

转到该存储库,创建一个develop分支,然后添加与该CC开发分支的CC视图集匹配的内容

Go to that repo, create a develop branch and add the content matching the CC view set for that CC develop branch

cd /path/to/my/repo
git checkout -b develop
git --work-tree=/path/to/ClearCase/view/aVob add .
git commit -m "add content of CC develop branch (no history though)"
git push -u origin develop

这篇关于BitBucket-直接添加到开发分支而不是master的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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