Catalog / Bazaar Version Control Cheatsheet

Bazaar Version Control Cheatsheet

A quick reference guide to Bazaar (bzr), a distributed version control system, covering common commands and workflows.

Basic Commands

Branch Creation and Setup

bzr init

Initialize a new Bazaar repository in the current directory.

bzr branch <source> [<branch_name>]

Create a branch from the specified source (another branch or repository). If <branch_name> is omitted, it branches into the current directory.

bzr checkout <branch_url>

Create a local working copy from a remote branch.

Making Changes

bzr add <file>

Add a new file to version control.

bzr add

Add all unversioned files in the current directory.

bzr remove <file>

Remove a file from version control.

bzr rename <old_file> <new_file>

Rename a file and track the rename in version control.

bzr status

Show the status of the working tree (modified, added, removed files).

Committing and Pushing

bzr commit -m "<message>"

Commit changes to the local branch with a descriptive message.

bzr push <target_url>

Push committed changes to a remote branch. <target_url> is the remote repository URL.

bzr pull

Pull changes from the parent branch into the current branch, merging automatically if possible.

Branch Management and Inspection

Branch Information

bzr info

Display information about the current branch, including the parent branch.

bzr log

Show the commit history of the current branch.

bzr revisions

List the revisions in a branch.

Merging and Conflicts

bzr merge <source_branch>

Merge changes from <source_branch> into the current branch.

bzr resolve

Mark conflicts as resolved after manually editing the conflicted files.

bzr commit -m "Merged <source_branch>"

Commit the merged changes, including conflict resolutions.

Working with Tags

bzr tag <tag_name>

Create a tag at the current revision.

bzr tags

List available tags in the branch.

bzr checkout -r <tag_name>

Checkout the branch at a specific tag.

Advanced Operations

Ignoring Files

Create a .bzrignore file in the root of your branch to specify files and patterns to ignore.

Example:

*.log
temp/

Shelving Changes

bzr shelve

Shelve (stash) current changes. It stores the uncommitted changes.

bzr unshelve

Unshelve the last shelved changes.

bzr shelve -l

List all shelved change sets.

Revert

bzr revert <file>

Revert changes in a specific file to the last committed version.

bzr revert

Revert all uncommitted changes in the working directory.

Remote Repositories

Working with Remote Branches

bzr pull <remote_branch>

Pull changes from a remote branch into the current branch.

bzr push <remote_branch>

Push changes to a remote branch.

bzr update

Update the local branch with the latest changes from the parent branch. Similar to bzr pull but more focused on keeping the branch synchronized with its parent.

Creating and Sharing Bundles

bzr bundle --create <bundle_file>

Create a bundle file containing the changesets in the branch. Useful for transferring changes without direct network access.

bzr apply <bundle_file>

Apply a bundle file to the current branch, integrating the changesets.