当地有 Bazaar 分店吗?

发布于 2024-08-09 04:06:27 字数 333 浏览 3 评论 0原文

我最近一直在研究 Git,以掌握分布式版本控制。现在我正在查看 Bazaar,但不知道如何创建本地分支,即当我想提交更改时不必推送到的分支。使用 Git,我可以执行

gitbranch_name

git checkout -bbranch_name

然后我可以在本地分支中工作,随时提交更改,而无需将更改推送到远程仓库。当我完成分支后,我可以将其合并到本地主分支。如果我愿意,我可以将这些更改推送到远程存储库。

Bazaar 可以做到这一点吗? Bazaar 看起来更像 SVN,分支只是单独的目录,所以也许不是。

I've been playing around with Git recently to get a grasp of distributed version control. Now I'm looking at Bazaar, but can't figure out how to make a local branch, i.e. a branch that I do not have to push to when I want to commit changes. With Git, I would do

git branch branch_name

or

git checkout -b branch_name

I can then work in my local branch, committing changes as I go, without having to push changes to a remote repo. When I'm through with the branch, I can merge it to my local master branch. If I want, I can then push those changes to the remote repo.

Is this possible with Bazaar? Bazaar seems much more like SVN, with branches just being separate directories, so maybe not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鲜血染红嫁衣 2024-08-16 04:06:27

是的,你绝对可以做到。

假设有一个远程存储库位于 bzr+ssh://foo.com/repo/mainline

您可以通过以下方式创建本地分支:

bzr branch bzr+ssh://foo.com/repo/mainline local_branch

现在,您可以对 local_branch 进行更改并提交它们,并且这些更改仅在该本地分支中目录。例如:

cd local_branch
touch foo
bzr add foo
bzr commit -m "Add foo."

这只会在本地分支中添加 foo 。

Yes, you definitely can do that.

Let's say there's a remote repository at bzr+ssh://foo.com/repo/mainline

You can create a local branch by doing:

bzr branch bzr+ssh://foo.com/repo/mainline local_branch

Now, you can make changes to the local_branch and commit them, and those changes are only in that local directory. e.g.:

cd local_branch
touch foo
bzr add foo
bzr commit -m "Add foo."

That will add foo only in the local branch.

潜移默化 2024-08-16 04:06:27

如果您以正确的方式设置存储库,则可以以与 git 类似的方式工作。

cd ~/dev
bzr init-repo
bzr reconfigure --with-no-trees
mkdir branches
bzr branch bzr+ssh://foo.com/repo branches/mainline
bzr checkout --lightweight branches/mainline working

这将创建一个像这样的结构:

/dev
    /branches
        /mainline
        <other branches go here>
    /working
        <this is your working tree>

如果你想创建分支,你可以执行以下操作:

cd ~/dev/checkout
bzr branch --switch ~/dev/branches/mainline ~/dev/branches/some-feature

现在你将处于 some-feature 分支中,该分支将与主线。

If you set up your repository the correct way, you can work in a similar fashion to git.

cd ~/dev
bzr init-repo
bzr reconfigure --with-no-trees
mkdir branches
bzr branch bzr+ssh://foo.com/repo branches/mainline
bzr checkout --lightweight branches/mainline working

This will create a structure like so:

/dev
    /branches
        /mainline
        <other branches go here>
    /working
        <this is your working tree>

And if you want to make branches, you can do the following:

cd ~/dev/checkout
bzr branch --switch ~/dev/branches/mainline ~/dev/branches/some-feature

and now you'll be in the some-feature branch, which will be at the same point as mainline.

哭泣的笑容 2024-08-16 04:06:27

老问题,但似乎 共置分支 是解决问题的方法如今这个。 Bzr 包含一个 插件,具有各种便利功能,包括 colo-init 用于创建支持并置分支的存储库,colo-branch 用于实际使用/创建分支(我还没有广泛使用这些功能,所以我可能会将此作为有点乱..)

Old question, but it appears that colocated branches are the way to go for this nowadays. Bzr includes a plugin with various convenience functions, including colo-init for creating colocated-branch-enabled repositories and colo-branch for actually using/creating branches (I have not made extensive use of these features yet, so I may have this a bit jumbled..)

苏璃陌 2024-08-16 04:06:27

bzr 与 git 的不同之处在于你无法切换工作目录所代表的分支。不过,您可以从工作目录进行分支,而不必从远程存储库进行分支。所以代替

git clone git+ssh://foo.com/repo
cd repo
git checkout -b new_branch

你会做

bzr branch bzr+ssh://foo.com/repo
bzr branch repo new_branch

bzr differs from git in that you can't switch the branch represented by the working directory. You can branch from your working directory, though, instead of having to branch from the remote repository. So instead of

git clone git+ssh://foo.com/repo
cd repo
git checkout -b new_branch

you would do

bzr branch bzr+ssh://foo.com/repo
bzr branch repo new_branch
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文