ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/v0.16.0/branches/index.html
Ilya Grigoriev f67d6a192c docs SEO (direct website push): Use "latest" URL as canonical URL for older versions
The replacement was done by `sed`.

This should only change versions of the docs prior to 864869ab (in
particular, not the `latest` version nor the `prerelease` version), and
make it as though the old version of the docs were compiled with that
commit. It tries to solve the same problem:
https://www.google.com/search?q=jj+revsets still points to jj v0.13
docs.

Google seems really slow to update its index, and I'm beginning to worry
that it might think we have a spammy site with many almost identical
pages. I hope it will pick up this change once it tries to update its
crawl of pages it's already indexing.

Loosely related reading: https://news.ycombinator.com/item?id=40970987
2024-07-25 14:29:08 -07:00

1625 lines
No EOL
42 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="canonical" href="https://martinvonz.github.io/jj/latest/branches/">
<link rel="prev" href="../working-copy/">
<link rel="next" href="../conflicts/">
<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.5.3, mkdocs-material-9.5.4">
<title>Branches - Jujutsu docs</title>
<link rel="stylesheet" href="../assets/stylesheets/main.50c56a3b.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#branches" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<div data-md-color-scheme="default" data-md-component="outdated" hidden>
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="Jujutsu docs" class="md-header__button md-logo" aria-label="Jujutsu docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Jujutsu docs
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Branches
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="(prefers-color-scheme)" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to system preference" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to system preference" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m14.3 16-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9h-1.9M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69m-9.15 3.96h2.3L12 9l-1.15 3.65Z"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_2" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_2">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12c0-2.42-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
</label>
</form>
<script>var media,input,key,value,palette=__md_get("__palette");if(palette&&palette.color){"(prefers-color-scheme)"===palette.color.media&&(media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']"),palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent"));for([key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Jujutsu docs" class="md-nav__button md-logo" aria-label="Jujutsu docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg>
</a>
Jujutsu docs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0">
<span class="md-ellipsis">
Getting started
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
Getting started
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../install-and-setup/" class="md-nav__link">
<span class="md-ellipsis">
Installation and Setup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../tutorial/" class="md-nav__link">
<span class="md-ellipsis">
Tutorial and Birds-Eye View
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../github/" class="md-nav__link">
<span class="md-ellipsis">
Working with GitHub
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../windows/" class="md-nav__link">
<span class="md-ellipsis">
Working on Windows
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../FAQ/" class="md-nav__link">
<span class="md-ellipsis">
FAQ
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../cli-reference/" class="md-nav__link">
<span class="md-ellipsis">
CLI Reference
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../testimonials/" class="md-nav__link">
<span class="md-ellipsis">
Testimonials
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<span class="md-ellipsis">
Concepts
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Concepts
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../working-copy/" class="md-nav__link">
<span class="md-ellipsis">
Working Copy
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Branches
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Branches
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#remotes-and-tracked-branches" class="md-nav__link">
<span class="md-ellipsis">
Remotes and tracked branches
</span>
</a>
<nav class="md-nav" aria-label="Remotes and tracked branches">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#terminology-summary" class="md-nav__link">
<span class="md-ellipsis">
Terminology summary
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#manually-tracking-a-branch" class="md-nav__link">
<span class="md-ellipsis">
Manually tracking a branch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#untracking-a-branch" class="md-nav__link">
<span class="md-ellipsis">
Untracking a branch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#listing-tracked-branches" class="md-nav__link">
<span class="md-ellipsis">
Listing tracked branches
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#automatic-tracking-of-branches-gitauto-local-branch-option" class="md-nav__link">
<span class="md-ellipsis">
Automatic tracking of branches &amp; git.auto-local-branch option
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#branch-movement" class="md-nav__link">
<span class="md-ellipsis">
Branch movement
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#conflicts" class="md-nav__link">
<span class="md-ellipsis">
Conflicts
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../conflicts/" class="md-nav__link">
<span class="md-ellipsis">
Conflicts
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../operation-log/" class="md-nav__link">
<span class="md-ellipsis">
Operation Log
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../glossary/" class="md-nav__link">
<span class="md-ellipsis">
Glossary
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<span class="md-ellipsis">
Configuration
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Configuration
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../config/" class="md-nav__link">
<span class="md-ellipsis">
Settings
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../revsets/" class="md-nav__link">
<span class="md-ellipsis">
Revset language
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../templates/" class="md-nav__link">
<span class="md-ellipsis">
Templating language
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<span class="md-ellipsis">
Comparisons
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Comparisons
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../git-comparison/" class="md-nav__link">
<span class="md-ellipsis">
Git comparison
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../git-compatibility/" class="md-nav__link">
<span class="md-ellipsis">
Git compatibility
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../sapling-comparison/" class="md-nav__link">
<span class="md-ellipsis">
Sapling
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../related-work/" class="md-nav__link">
<span class="md-ellipsis">
Other related work
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
<span class="md-ellipsis">
Technical details
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Technical details
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../technical/architecture/" class="md-nav__link">
<span class="md-ellipsis">
Architecture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../technical/concurrency/" class="md-nav__link">
<span class="md-ellipsis">
Concurrency
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../technical/conflicts/" class="md-nav__link">
<span class="md-ellipsis">
Conflicts
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
<span class="md-ellipsis">
Contributing
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Contributing
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../contributing/" class="md-nav__link">
<span class="md-ellipsis">
Guidelines and "How to...?"
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../code-of-conduct/" class="md-nav__link">
<span class="md-ellipsis">
Code of conduct
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_11" >
<label class="md-nav__link" for="__nav_11" id="__nav_11_label" tabindex="0">
<span class="md-ellipsis">
Design docs
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_11_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_11">
<span class="md-nav__icon md-icon"></span>
Design docs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../design/git-submodules/" class="md-nav__link">
<span class="md-ellipsis">
git-submodules
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/git-submodule-storage/" class="md-nav__link">
<span class="md-ellipsis">
git-submodule-storage
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/run/" class="md-nav__link">
<span class="md-ellipsis">
JJ run
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/sparse-v2/" class="md-nav__link">
<span class="md-ellipsis">
Sparse Patterns v2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/tracking-branches/" class="md-nav__link">
<span class="md-ellipsis">
Tracking branches
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#remotes-and-tracked-branches" class="md-nav__link">
<span class="md-ellipsis">
Remotes and tracked branches
</span>
</a>
<nav class="md-nav" aria-label="Remotes and tracked branches">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#terminology-summary" class="md-nav__link">
<span class="md-ellipsis">
Terminology summary
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#manually-tracking-a-branch" class="md-nav__link">
<span class="md-ellipsis">
Manually tracking a branch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#untracking-a-branch" class="md-nav__link">
<span class="md-ellipsis">
Untracking a branch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#listing-tracked-branches" class="md-nav__link">
<span class="md-ellipsis">
Listing tracked branches
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#automatic-tracking-of-branches-gitauto-local-branch-option" class="md-nav__link">
<span class="md-ellipsis">
Automatic tracking of branches &amp; git.auto-local-branch option
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#branch-movement" class="md-nav__link">
<span class="md-ellipsis">
Branch movement
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#conflicts" class="md-nav__link">
<span class="md-ellipsis">
Conflicts
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="branches">Branches<a class="headerlink" href="#branches" title="Permanent link">&para;</a></h1>
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">&para;</a></h2>
<p>Branches are named pointers to revisions (just like they are in Git). You can
move them without affecting the target revision's identity. Branches
automatically move when revisions are rewritten (e.g. by <code>jj rebase</code>). You can
pass a branch's name to commands that want a revision as argument. For example,
<code>jj co main</code> will check out the revision pointed to by the "main" branch. Use
<code>jj branch list</code> to list branches and <code>jj branch</code> to create, move, or delete
branches. There is currently no concept of an active/current/checked-out branch.</p>
<h2 id="remotes-and-tracked-branches">Remotes and tracked branches<a class="headerlink" href="#remotes-and-tracked-branches" title="Permanent link">&para;</a></h2>
<p>Jujutsu records the last seen position of a branch on each remote (just like
Git's remote-tracking branches). This record is updated on every <code>jj git fetch</code>
and <code>jj git push</code> of the branch. You can refer to the remembered remote branch
positions with <code>&lt;branch name&gt;@&lt;remote name&gt;</code>, such as <code>jj new main@origin</code>. <code>jj</code>
does not provide a way to manually edit these recorded positions.</p>
<p>A remote branch can be associated with a local branch of the same name. This is
called a <strong>tracked remote branch</strong>. When you pull a tracked branch from a
remote, any changes compared to the current record of the remote's state will be
propagated to the corresponding local branch, which will be created if it
doesn't exist already.</p>
<div class="admonition note">
<p class="admonition-title">Details: how <code>fetch</code> pulls branches</p>
<p>Let's say you run <code>jj git fetch --remote origin</code> and, during the fetch, <code>jj</code>
determines that the remote's "main" branch has been moved so that its target is
now ahead of the local record in <code>main@origin</code>.</p>
<p><code>jj</code> will then update <code>main@origin</code> to the new target. If <code>main@origin</code> is
<strong>tracked</strong>, <code>jj</code> will also apply the change to the local branch <code>main</code>. If the
local target has also been moved compared to <code>main@origin</code> (probably because you
ran <code>jj branch set main</code>), then the two updates will be merged. If one is ahead
of the other, then that target will become the new target. Otherwise, the local
branch will become conflicted (see the <a href="#conflicts">"Conflicts" section</a> below
for details).</p>
</div>
<p>Most commands don't show the tracked remote branch if it has the same target as
the local branch. The local branch (without <code>@&lt;remote name&gt;</code>) is considered the
branch's desired target. Consequently, if you want to update a branch on a
remote, you first update the branch locally and then push the update to the
remote. If a local branch also exists on some remote but points to a different
target there, <code>jj log</code> will show the branch name with an asterisk suffix (e.g.
<code>main*</code>). That is meant to remind you that you may want to push the branch to
some remote.</p>
<p>If you want to know the internals of branch tracking, consult the
<a href="../design/tracking-branches/">Design Doc</a>.</p>
<h3 id="terminology-summary">Terminology summary<a class="headerlink" href="#terminology-summary" title="Permanent link">&para;</a></h3>
<ul>
<li>A <strong>remote branch</strong> is a branch ref on the remote. <code>jj</code> can find out its
actual state only when it's actively communicating with the remote. However,
<code>jj</code> does store the last-seen position of the remote branch; this is the
commit <code>jj show &lt;branch name&gt;@&lt;remote name&gt;</code> would show. This notion is
completely analogous to Git's "remote-tracking branches".</li>
<li>A <strong>tracked (remote) branch</strong> is defined above. You can make a remote branch
tracked with the <a href="#manually-tracking-a-branch"><code>jj branch track</code> command</a>, for
example.</li>
<li>A <strong>tracking (local) branch</strong> is the local branch that <code>jj</code> tries to keep in
sync with the tracked remote branch. For example, after <code>jj branch track
mybranch@origin</code>, there will be a local branch <code>mybranch</code> that's tracking the
remote <code>mybranch@origin</code> branch. A local branch can track a branch of the same
name on 0 or more remotes.</li>
</ul>
<p>The notion of tracked branches serves a similar function to the Git notion of an
"upstream branch". Unlike Git, a single local branch can be tracking remote
branches on multiple remotes, and the names of the local and remote branches
must match.</p>
<h3 id="manually-tracking-a-branch">Manually tracking a branch<a class="headerlink" href="#manually-tracking-a-branch" title="Permanent link">&para;</a></h3>
<p>To track a branch permanently use <code>jj branch track &lt;branch name&gt;@&lt;remote name&gt;</code>.
It will now be imported as a local branch until you untrack it or it is deleted
on the remote. </p>
<p>Example:</p>
<div class="highlight"><pre><span></span><code>$<span class="w"> </span><span class="c1"># List all available branches, as we want our colleague&#39;s branch.</span>
$<span class="w"> </span>jj<span class="w"> </span>branch<span class="w"> </span>list<span class="w"> </span>--all
$<span class="w"> </span><span class="c1"># Find the branch.</span>
$<span class="w"> </span><span class="c1"># [...]</span>
$<span class="w"> </span><span class="c1"># Actually track the branch.</span>
$<span class="w"> </span>jj<span class="w"> </span>branch<span class="w"> </span>track<span class="w"> </span>&lt;branch<span class="w"> </span>name&gt;@&lt;remote<span class="w"> </span>name&gt;<span class="w"> </span><span class="c1"># Example: jj branch track my-feature@origin</span>
$<span class="w"> </span><span class="c1"># From this point on, &lt;branch name&gt; will be imported when fetching from &lt;remote name&gt;.</span>
$<span class="w"> </span>jj<span class="w"> </span>git<span class="w"> </span>fetch<span class="w"> </span>--remote<span class="w"> </span>&lt;remote<span class="w"> </span>name&gt;
$<span class="w"> </span><span class="c1"># A local branch &lt;branch name&gt; should have been created or updated while fetching.</span>
$<span class="w"> </span>jj<span class="w"> </span>new<span class="w"> </span>&lt;branch<span class="w"> </span>name&gt;<span class="w"> </span><span class="c1"># Do some local testing, etc.</span>
</code></pre></div>
<h3 id="untracking-a-branch">Untracking a branch<a class="headerlink" href="#untracking-a-branch" title="Permanent link">&para;</a></h3>
<p>To stop following a remote branch, you can <code>jj branch untrack</code> it. After that,
subsequent fetches of that remote will no longer move the local branch to match
the position of the remote branch.</p>
<p>Example: </p>
<div class="highlight"><pre><span></span><code>$<span class="w"> </span><span class="c1"># List all local and remote branches.</span>
$<span class="w"> </span>jj<span class="w"> </span>branch<span class="w"> </span>list<span class="w"> </span>--all
$<span class="w"> </span><span class="c1"># Find the branch we no longer want to track.</span>
$<span class="w"> </span><span class="c1"># [...]</span>
<span class="c1"># # Actually untrack it.</span>
$<span class="w"> </span>jj<span class="w"> </span>branch<span class="w"> </span>untrack<span class="w"> </span>&lt;branch<span class="w"> </span>name&gt;@&lt;remote<span class="w"> </span>name&gt;<span class="w"> </span><span class="c1"># Example: jj branch untrack stuff@origin</span>
$<span class="w"> </span><span class="c1"># From this point on, this remote branch won&#39;t be imported anymore.</span>
$<span class="w"> </span><span class="c1"># The local branch (e.g. stuff) is unaffected. It may or may not still</span>
$<span class="w"> </span><span class="c1"># be tracking branches on other remotes (e.g. stuff@upstream).</span>
</code></pre></div>
<h3 id="listing-tracked-branches">Listing tracked branches<a class="headerlink" href="#listing-tracked-branches" title="Permanent link">&para;</a></h3>
<p>To list tracked branches, you can <code>jj branch list --tracked</code> or <code>jj branch list -t</code>.
This command omits local Git-tracking branches by default.</p>
<p>You can see if a specific branch is tracked with <code>jj branch list --tracked &lt;branch name&gt;</code>.</p>
<h3 id="automatic-tracking-of-branches-gitauto-local-branch-option">Automatic tracking of branches &amp; <code>git.auto-local-branch</code> option<a class="headerlink" href="#automatic-tracking-of-branches-gitauto-local-branch-option" title="Permanent link">&para;</a></h3>
<p>There are two situations where <code>jj</code> tracks branches automatically. <code>jj git
clone</code> automatically sets up the default remote branch (e.g. <code>main@origin</code>) as
tracked. When you push a local branch, the newly created branch on the remote is
marked as tracked.</p>
<p>By default, every other remote branch is marked as "not tracked" when it's
fetched. If desired, you need to manually <code>jj branch track</code> them. This works
well for repositories where multiple people work on a large number of branches. </p>
<p>The default can be changed by setting the config <code>git.auto-local-branch = true</code>.
Then, <code>jj git fetch</code> tracks every <em>newly fetched</em> branch with a local branch.
Branches that already existed before the <code>jj git fetch</code> are not affected. This
is similar to Mercurial, which fetches all its bookmarks (equivalent to Git
branches) by default.</p>
<h2 id="branch-movement">Branch movement<a class="headerlink" href="#branch-movement" title="Permanent link">&para;</a></h2>
<p>Currently Jujutsu automatically moves local branches when these conditions are
met:</p>
<ul>
<li>When a commit has been rewritten (e.g, when you rebase) branches and the<br />
working-copy will move along with it.</li>
<li>When a commit has been abandoned, all associated branches will be moved
to its parent(s). If a working copy was pointing to the abandoned commit,
then a new working-copy commit will be created on top of the parent(s).</li>
</ul>
<p>You could describe the movement as following along the change-id of the
current branch commit, even if it isn't entirely accurate.</p>
<h2 id="conflicts">Conflicts<a class="headerlink" href="#conflicts" title="Permanent link">&para;</a></h2>
<p>Branches can end up in a conflicted state. When that happens, <code>jj status</code> will
include information about the conflicted branches (and instructions for how to
mitigate it). <code>jj branch list</code> will have details. <code>jj log</code> will show the branch
name with a question mark suffix (e.g. <code>main?</code>) on each of the conflicted
branch's potential target revisions. Using the branch name to look up a revision
will resolve to all potential targets. That means that <code>jj co main</code> will error
out, complaining that the revset resolved to multiple revisions.</p>
<p>Both local branches (e.g. <code>main</code>) and the remote branch (e.g. <code>main@origin</code>) can
have conflicts. Both can end up in that state if concurrent operations were run
in the repo. The local branch more typically becomes conflicted because it was
updated both locally and on a remote.</p>
<p>To resolve a conflicted state in a local branch (e.g. <code>main</code>), you can move the
branch to the desired target with <code>jj branch</code>. You may want to first either
merge the conflicted targets with <code>jj merge</code>, or you may want to rebase one side
on top of the other with <code>jj rebase</code>.</p>
<p>To resolve a conflicted state in a remote branch (e.g. <code>main@origin</code>), simply
pull from the remote (e.g. <code>jj git fetch</code>). The conflict resolution will also
propagate to the local branch (which was presumably also conflicted).</p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.c011b7c0.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
<script src="../assets/javascripts/bundle.7389ff0e.min.js"></script>
</body>
</html>