2023-08-26 04:56:32 +00:00
<!doctype html>
< html lang = "en" class = "no-js" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width,initial-scale=1" >
2023-10-03 03:41:01 +00:00
< link rel = "canonical" href = "https://martinvonz.github.io/jj/prerelease/design/tracking-branches/" >
2023-08-26 04:56:32 +00:00
2023-10-03 03:41:01 +00:00
< link rel = "prev" href = "../run/" >
2023-08-26 04:56:32 +00:00
2023-10-03 03:41:01 +00:00
< link rel = "icon" href = "../../assets/images/favicon.png" >
2023-08-28 17:58:36 +00:00
< meta name = "generator" content = "mkdocs-1.5.2, mkdocs-material-9.2.5" >
2023-08-26 04:56:32 +00:00
< title > Tracking branches - Jujutsu docs< / title >
2023-10-03 03:41:01 +00:00
< link rel = "stylesheet" href = "../../assets/stylesheets/main.0e669242.min.css" >
2023-08-26 04:56:32 +00:00
< 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 >
2023-10-03 03:41:01 +00:00
< 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 >
2023-08-26 04:56:32 +00:00
< / head >
< body dir = "ltr" >
< script > var palette = _ _md _get ( "__palette" ) ; if ( palette && "object" == typeof palette . color ) for ( var key of Object . keys ( palette . color ) ) document . body . setAttribute ( "data-md-color-" + key , palette . color [ key ] ) < / script >
< 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 = "#remotegit-tracking-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" >
2023-10-03 03:41:01 +00:00
< a href = "../.." title = "Jujutsu docs" class = "md-header__button md-logo" aria-label = "Jujutsu docs" data-md-component = "logo" >
2023-08-26 04:56:32 +00:00
< 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" >
Tracking branches
< / span >
< / div >
< / div >
< / div >
2023-08-28 17:58:36 +00:00
< 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 >
2023-08-26 04:56:32 +00:00
< / 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" >
2023-10-03 03:41:01 +00:00
< a href = "../.." title = "Jujutsu docs" class = "md-nav__button md-logo" aria-label = "Jujutsu docs" data-md-component = "logo" >
2023-08-26 04:56:32 +00:00
< 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 >
2023-10-04 02:59:08 +00:00
< li class = "md-nav__item" >
< a href = "../.." class = "md-nav__link" >
< span class = "md-ellipsis" >
Home
< / span >
< / a >
< / li >
2023-08-26 04:56:32 +00:00
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_2" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_2" id = "__nav_2_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Getting started
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_2_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_2" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Getting started
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../install-and-setup/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Installation and Setup
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../tutorial/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Tutorial and Birds-Eye View
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../github/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
2023-08-28 17:58:36 +00:00
Working with GitHub
2023-08-26 04:56:32 +00:00
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../FAQ/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
FAQ
< / span >
< / a >
< / li >
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_4" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_4" id = "__nav_4_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Concepts
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_4_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_4" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Concepts
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../working-copy/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Working Copy
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../branches/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Branches
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../conflicts/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Conflicts
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../operation-log/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Operation Log
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../glossary/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Glossary
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_5" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_5" id = "__nav_5_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Configuration
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_5_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_5" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Configuration
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../config/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Settings
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../revsets/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Revset language
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../templates/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Templating language
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_6" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_6" id = "__nav_6_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Comparisons
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_6_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_6" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Comparisons
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../git-comparison/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Git comparison
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../git-compatibility/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Git compatibility
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../sapling-comparison/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Sapling
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../related-work/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Other related work
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_7" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_7" id = "__nav_7_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Technical details
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_7_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_7" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Technical details
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../technical/architecture/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Architecture
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../technical/concurrency/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Concurrency
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../technical/conflicts/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Conflicts
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_8" >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_8" id = "__nav_8_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Contributing
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_8_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_8" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Contributing
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../contributing/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
2023-08-28 17:58:36 +00:00
Guidelines and "How to...?"
2023-08-26 04:56:32 +00:00
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../../code-of-conduct/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Code of conduct
< / span >
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item md-nav__item--active md-nav__item--nested" >
2023-10-04 02:59:08 +00:00
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_9" checked >
2023-08-26 04:56:32 +00:00
2023-10-04 02:59:08 +00:00
< label class = "md-nav__link" for = "__nav_9" id = "__nav_9_label" tabindex = "0" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Design docs
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-04 02:59:08 +00:00
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_9_label" aria-expanded = "true" >
< label class = "md-nav__title" for = "__nav_9" >
2023-08-26 04:56:32 +00:00
< span class = "md-nav__icon md-icon" > < / span >
Design docs
< / label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../git-submodules/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
git-submodules
< / span >
< / a >
< / li >
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../git-submodule-storage/" class = "md-nav__link" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
git-submodule-storage
< / span >
< / a >
< / li >
2023-09-14 14:40:17 +00:00
< li class = "md-nav__item" >
2023-10-03 03:41:01 +00:00
< a href = "../run/" class = "md-nav__link" >
2023-09-14 14:40:17 +00:00
< span class = "md-ellipsis" >
JJ run
< / span >
< / a >
< / li >
2023-08-26 04:56:32 +00:00
< 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" >
Tracking branches
< / span >
< span class = "md-nav__icon md-icon" > < / span >
< / label >
2023-10-03 03:41:01 +00:00
< a href = "./" class = "md-nav__link md-nav__link--active" >
2023-08-26 04:56:32 +00:00
< span class = "md-ellipsis" >
Tracking 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 = "#objective" class = "md-nav__link" >
Objective
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#current-data-model-as-of-jj-080" class = "md-nav__link" >
Current data model (as of jj 0.8.0)
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#proposed-data-model" class = "md-nav__link" >
Proposed data model
< / a >
< nav class = "md-nav" aria-label = "Proposed data model" >
< ul class = "md-nav__list" >
2023-09-28 09:01:21 +00:00
< li class = "md-nav__item" >
< a href = "#importexport-data-flow" class = "md-nav__link" >
Import/export data flow
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#tracking-state" class = "md-nav__link" >
Tracking state
< / a >
< / li >
2023-08-26 04:56:32 +00:00
< li class = "md-nav__item" >
< a href = "#mapping-to-the-current-data-model" class = "md-nav__link" >
Mapping to the current data model
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#common-command-behaviors" class = "md-nav__link" >
Common command behaviors
< / a >
< nav class = "md-nav" aria-label = "Common command behaviors" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#fetchimport" class = "md-nav__link" >
fetch/import
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#pushexport" class = "md-nav__link" >
push/export
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#initclone" class = "md-nav__link" >
init/clone
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#branch" class = "md-nav__link" >
branch
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#command-behavior-examples" class = "md-nav__link" >
Command behavior examples
< / a >
< nav class = "md-nav" aria-label = "Command behavior examples" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#fetchimport_1" class = "md-nav__link" >
fetch/import
< / a >
< / li >
< li class = "md-nav__item" >
2023-09-28 09:01:21 +00:00
< a href = "#push" class = "md-nav__link" >
push
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#export" class = "md-nav__link" >
export
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#undo-fetch" class = "md-nav__link" >
undo fetch
2023-08-26 04:56:32 +00:00
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#git-remote" class = "md-nav__link" >
@git remote
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#remaining-issues" class = "md-nav__link" >
Remaining issues
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#references" class = "md-nav__link" >
References
< / a >
< / li >
< / ul >
< / nav >
< / 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 = "#objective" class = "md-nav__link" >
Objective
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#current-data-model-as-of-jj-080" class = "md-nav__link" >
Current data model (as of jj 0.8.0)
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#proposed-data-model" class = "md-nav__link" >
Proposed data model
< / a >
< nav class = "md-nav" aria-label = "Proposed data model" >
< ul class = "md-nav__list" >
2023-09-28 09:01:21 +00:00
< li class = "md-nav__item" >
< a href = "#importexport-data-flow" class = "md-nav__link" >
Import/export data flow
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#tracking-state" class = "md-nav__link" >
Tracking state
< / a >
< / li >
2023-08-26 04:56:32 +00:00
< li class = "md-nav__item" >
< a href = "#mapping-to-the-current-data-model" class = "md-nav__link" >
Mapping to the current data model
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#common-command-behaviors" class = "md-nav__link" >
Common command behaviors
< / a >
< nav class = "md-nav" aria-label = "Common command behaviors" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#fetchimport" class = "md-nav__link" >
fetch/import
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#pushexport" class = "md-nav__link" >
push/export
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#initclone" class = "md-nav__link" >
init/clone
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#branch" class = "md-nav__link" >
branch
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#command-behavior-examples" class = "md-nav__link" >
Command behavior examples
< / a >
< nav class = "md-nav" aria-label = "Command behavior examples" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#fetchimport_1" class = "md-nav__link" >
fetch/import
< / a >
< / li >
< li class = "md-nav__item" >
2023-09-28 09:01:21 +00:00
< a href = "#push" class = "md-nav__link" >
push
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#export" class = "md-nav__link" >
export
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#undo-fetch" class = "md-nav__link" >
undo fetch
2023-08-26 04:56:32 +00:00
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#git-remote" class = "md-nav__link" >
@git remote
< / a >
< / li >
< / ul >
< / nav >
< / li >
< li class = "md-nav__item" >
< a href = "#remaining-issues" class = "md-nav__link" >
Remaining issues
< / a >
< / li >
< li class = "md-nav__item" >
< a href = "#references" class = "md-nav__link" >
References
< / a >
< / li >
< / ul >
< / nav >
< / div >
< / div >
< / div >
< div class = "md-content" data-md-component = "content" >
< article class = "md-content__inner md-typeset" >
2023-08-28 17:58:36 +00:00
< h1 id = "remotegit-tracking-branches" > Remote/< code > @git< / code > tracking branches< a class = "headerlink" href = "#remotegit-tracking-branches" title = "Permanent link" > ¶ < / a > < / h1 >
2023-08-26 04:56:32 +00:00
< p > This is a plan to implement more Git-like remote tracking branch UX.< / p >
2023-08-28 17:58:36 +00:00
< h2 id = "objective" > Objective< a class = "headerlink" href = "#objective" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< p > < code > jj< / code > imports all remote branches to local branches by default. As described in
< a href = "https://github.com/martinvonz/jj/issues/1136" > #1136< / a > , this doesn't interact nicely with Git if we have multiple Git remotes
with a number of branches. The < code > git.auto-local-branch< / code > config can mitigate this
problem, but we'll get locally-deleted branches instead.< / p >
< p > The goal of this plan is to implement
* proper support for tracking/non-tracking remote branches
* logically consistent data model for importing/exporting Git refs< / p >
2023-08-28 17:58:36 +00:00
< h2 id = "current-data-model-as-of-jj-080" > Current data model (as of jj 0.8.0)< a class = "headerlink" href = "#current-data-model-as-of-jj-080" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< p > Under the current model, all remote branches are "tracking" branches, and
remote changes are merged into the local counterparts.< / p >
2023-08-28 17:58:36 +00:00
< div class = "highlight" > < pre > < span > < / span > < code > branches
2023-08-26 04:56:32 +00:00
[name]:
local_target?
remote_targets[remote]: target
tags
[name]: target
git_refs
[" refs/heads/{name}" ]: target # last-known local branches
[" refs/remotes/{remote}/{name}" ]: target # last-known remote branches
# (copied to remote_targets)
[" refs/tags/{name}" ]: target # last-known tags
git_head: target?
< / code > < / pre > < / div >
< ul >
< li > Remote branches are stored in both < code > branches[name].remote_targets< / code > and
2023-09-28 09:01:21 +00:00
< code > git_refs["refs/remotes"]< / code > . These two are mostly kept in sync, but there
are two scenarios where remote-tracking branches and git refs can diverge:
1. < code > jj branch forget< / code >
2. < code > jj op undo< / code > /< code > restore< / code > in colocated repo< / li >
< li > Pseudo < code > @git< / code > tracking branches are stored in < code > git_refs["refs/heads"]< / code > . We
need special case to resolve < code > @git< / code > branches, and their behavior is slightly
different from the other remote-tracking branches.< / li >
2023-08-26 04:56:32 +00:00
< / ul >
2023-08-28 17:58:36 +00:00
< h2 id = "proposed-data-model" > Proposed data model< a class = "headerlink" href = "#proposed-data-model" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< p > We'll add a per-remote-branch < code > state< / code > to distinguish non-tracking branches
from tracking ones.< / p >
2023-08-28 17:58:36 +00:00
< div class = "highlight" > < pre > < span > < / span > < code > state = new # not merged in the local branch or tag
2023-08-26 04:56:32 +00:00
| tracking # merged in the local branch or tag
# `ignored` state could be added if we want to manage it by view, not by
# config file. target of ignored remote branch would be absent.
< / code > < / pre > < / div >
< p > We'll add a per-remote view-like object to record the last known remote
2023-09-28 09:01:21 +00:00
branches. It will replace < code > branches[name].remote_targets< / code > in the current model.
< code > @git< / code > branches will be stored in < code > remotes["git"]< / code > .< / p >
2023-08-28 17:58:36 +00:00
< div class = "highlight" > < pre > < span > < / span > < code > branches
2023-08-26 04:56:32 +00:00
[name]: target
tags
[name]: target
remotes
[" git" ]:
branches
[name]: target, state # refs/heads/{name}
tags
[name]: target, state = tracking # refs/tags/{name}
head: target?, state = TBD # refs/HEAD
[remote]:
branches
[name]: target, state # refs/remotes/{remote}/{name}
tags: (empty)
head: (empty)
2023-09-28 09:01:21 +00:00
git_refs # last imported/exported refs
[" refs/heads/{name}" ]: target
[" refs/remotes/{remote}/{name}" ]: target
[" refs/tags/{name}" ]: target
2023-08-26 04:56:32 +00:00
< / code > < / pre > < / div >
< p > With the proposed data model, we can
* naturally support remote branches which have no local counterparts
2023-09-28 09:01:21 +00:00
* deduplicate < code > branches[name].remote_targets< / code > and < code > git_refs["refs/remotes"]< / code > < / p >
< h3 id = "importexport-data-flow" > Import/export data flow< a class = "headerlink" href = "#importexport-data-flow" title = "Permanent link" > ¶ < / a > < / h3 >
< div class = "highlight" > < pre > < span > < / span > < code > export flow import flow
----------- -----------
+----------------+ --.
+-------------------> |backing Git repo|---+ :
| +----------------+ | : unchanged
|[update] |[copy] : on " op restore"
| +----------+ | :
| +--------------> | git_refs |< ------+ :
| | +----------+ | --'
+--[compare] [diff]--+
| .-- +---------------+ | | --.
| : +---> |remotes[" git" ] | | | :
+---: | | |< ---+ | :
: | |remotes[remote]| | : restored
' -- | +---------------+ |[merge] : on " op restore"
| | : by default
[copy]| +---------------+ | :
+----| (local) |< ---------+ :
| branches/tags | :
+---------------+ --'
< / code > < / pre > < / div >
< ul >
< li > < code > jj git import< / code > applies diff between < code > git_refs< / code > and < code > remotes[]< / code > . < code > git_refs< / code > is
always copied from the backing Git repo.< / li >
< li > < code > jj git export< / code > copies jj's < code > remotes< / code > view back to the Git repo. If a ref in
the Git repo has been updated since the last import, the ref isn't exported.< / li >
< li > < code > jj op restore< / code > never rolls back < code > git_refs< / code > .< / li >
< / ul >
< h3 id = "tracking-state" > Tracking state< a class = "headerlink" href = "#tracking-state" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< p > The < code > git.auto-local-branch< / code > config knob is applied when importing new remote
branch. < code > jj branch< / code > sub commands will be added to change the tracking state.< / p >
2023-08-28 17:58:36 +00:00
< div class = "highlight" > < pre > < span > < / span > < code > < span class = "k" > fn< / span > < span class = "nf" > default_state_for_newly_imported_branch< / span > < span class = "p" > (< / span > < span class = "n" > config< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > remote< / span > < span class = "p" > )< / span > < span class = "w" > < / span > < span class = "p" > {< / span >
2023-08-26 04:56:32 +00:00
< span class = "w" > < / span > < span class = "k" > if< / span > < span class = "w" > < / span > < span class = "n" > remote< / span > < span class = "w" > < / span > < span class = "o" > ==< / span > < span class = "w" > < / span > < span class = "s" > " git" < / span > < span class = "w" > < / span > < span class = "p" > {< / span >
< span class = "w" > < / span > < span class = "n" > State< / span > ::< span class = "n" > Tracking< / span >
< span class = "w" > < / span > < span class = "p" > }< / span > < span class = "w" > < / span > < span class = "k" > else< / span > < span class = "w" > < / span > < span class = "k" > if< / span > < span class = "w" > < / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s" > " git.auto-local-branch" < / span > < span class = "p" > ]< / span > < span class = "w" > < / span > < span class = "p" > {< / span >
< span class = "w" > < / span > < span class = "n" > State< / span > ::< span class = "n" > Tracking< / span >
< span class = "w" > < / span > < span class = "p" > }< / span > < span class = "w" > < / span > < span class = "k" > else< / span > < span class = "w" > < / span > < span class = "p" > {< / span >
< span class = "w" > < / span > < span class = "n" > State< / span > ::< span class = "n" > New< / span >
< span class = "w" > < / span > < span class = "p" > }< / span >
< span class = "p" > }< / span >
< / code > < / pre > < / div >
< p > A branch target to be merged is calculated based on the < code > state< / code > .< / p >
2023-08-28 17:58:36 +00:00
< div class = "highlight" > < pre > < span > < / span > < code > < span class = "k" > fn< / span > < span class = "nf" > target_in_merge_context< / span > < span class = "p" > (< / span > < span class = "n" > known_target< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > state< / span > < span class = "p" > )< / span > < span class = "w" > < / span > < span class = "p" > {< / span >
2023-08-26 04:56:32 +00:00
< span class = "w" > < / span > < span class = "k" > match< / span > < span class = "w" > < / span > < span class = "n" > state< / span > < span class = "w" > < / span > < span class = "p" > {< / span >
< span class = "w" > < / span > < span class = "n" > State< / span > ::< span class = "n" > New< / span > < span class = "w" > < / span > < span class = "o" > => < / span > < span class = "w" > < / span > < span class = "n" > RefTarget< / span > ::< span class = "n" > absent< / span > < span class = "p" > (),< / span >
< span class = "w" > < / span > < span class = "n" > State< / span > ::< span class = "n" > Tracking< / span > < span class = "w" > < / span > < span class = "o" > => < / span > < span class = "w" > < / span > < span class = "n" > known_target< / span > < span class = "p" > ,< / span >
< span class = "w" > < / span > < span class = "p" > }< / span >
< span class = "p" > }< / span >
< / code > < / pre > < / div >
2023-08-28 17:58:36 +00:00
< h3 id = "mapping-to-the-current-data-model" > Mapping to the current data model< a class = "headerlink" href = "#mapping-to-the-current-data-model" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
2023-09-28 09:01:21 +00:00
< li > New < code > remotes["git"].branches< / code > corresponds to < code > git_refs["refs/heads"]< / code > , but
forgotten branches are removed from < code > remotes["git"].branches< / code > .< / li >
2023-08-26 04:56:32 +00:00
< li > New < code > remotes["git"].tags< / code > corresponds to < code > git_refs["refs/tags"]< / code > .< / li >
< li > New < code > remotes["git"].head< / code > corresponds to < code > git_head< / code > .< / li >
< li > New < code > remotes[remote].branches< / code > corresponds to
2023-09-28 09:01:21 +00:00
< code > branches[].remote_targets[remote]< / code > .< / li >
2023-08-26 04:56:32 +00:00
< li > < code > state = new|tracking< / code > doesn't exist in the current model. It's determined
by < code > git.auto-local-branch< / code > config.< / li >
< / ul >
2023-08-28 17:58:36 +00:00
< h2 id = "common-command-behaviors" > Common command behaviors< a class = "headerlink" href = "#common-command-behaviors" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< p > In the following sections, a merge is expressed as < code > adds - removes< / code > .
In particular, a merge of local and remote targets is
< code > [local, remote] - [known_remote]< / code > .< / p >
2023-08-28 17:58:36 +00:00
< h3 id = "fetchimport" > fetch/import< a class = "headerlink" href = "#fetchimport" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li >
< p > < code > jj git fetch< / code >
1. Fetches remote changes to the backing Git repo.
2. Import changes only for < code > remotes[remote].branches[glob]< / code > (see below)< / p >
< ul >
< li > TODO: how about fetched < code > .tags< / code > ?< / li >
< / ul >
< / li >
< li >
< p > < code > jj git import< / code >
2023-09-28 09:01:21 +00:00
1. Copies < code > git_refs< / code > from the backing Git repo.
2. Calculates diff from the known < code > remotes< / code > to the new < code > git_refs< / code > .< / p >
2023-08-26 04:56:32 +00:00
< ul >
2023-09-28 09:01:21 +00:00
< li > < code > git_refs["refs/heads"] - remotes["git"].branches< / code > < / li >
< li > < code > git_refs["refs/tags"] - remotes["git"].tags< / code > < / li >
< li > TBD: < code > "HEAD" - remotes["git"].head< / code > (unused)< / li >
< li > < code > git_refs["refs/remotes/{remote}"] - remotes[remote]< / code >
3. Merges diff in local < code > branches< / code > and < code > tags< / code > if < code > state< / code > is < code > tracking< / code > .< / li >
< li > If the known < code > target< / code > is < code > absent< / code > , the default < code > state< / code > should be
calculated. This also applies to previously-forgotten branches.
4. Updates < code > remotes< / code > reflecting the import.
5. Abandons commits that are no longer referenced.< / li >
2023-08-26 04:56:32 +00:00
< / ul >
< / li >
< / ul >
2023-08-28 17:58:36 +00:00
< h3 id = "pushexport" > push/export< a class = "headerlink" href = "#pushexport" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li >
< p > < code > jj git push< / code >
1. Calculates diff from the known < code > remotes[remote]< / code > to the local changes.< / p >
< ul >
< li > < code > branches - remotes[remote].branches< / code > < / li >
2023-09-28 09:01:21 +00:00
< li > If < code > state< / code > is < code > new< / code > (i.e. untracked), the known remote branch < code > target< / code >
is considered < code > absent< / code > .< / li >
< li > If < code > state< / code > is < code > new< / code > , and if the local branch < code > target< / code > is < code > absent< / code > , the
diff < code > [absent, remote] - absent< / code > is noop. So it's not allowed to push
deleted branch to untracked remote.< / li >
2023-08-26 04:56:32 +00:00
< li > TODO: Copy Git's < code > --force-with-lease< / code > behavior?< / li >
< li > ~< code > tags< / code > ~ (not implemented, but should be the same as < code > branches< / code > )
2. Pushes diff to the remote Git repo (as well as remote tracking branches
in the backing Git repo.)
3. Sets < code > remotes[remote].branches[name].state = tracking< / code >
4. Import changes only for < code > remotes[remote].branches[glob]< / code > < / li >
< / ul >
< / li >
< li >
< p > < code > jj git export< / code >
2023-09-28 09:01:21 +00:00
1. Copies local < code > branches< / code > /< code > tags< / code > back to < code > remotes["git"]< / code > .< / p >
2023-08-26 04:56:32 +00:00
< ul >
2023-09-28 09:01:21 +00:00
< li > Conceptually, < code > remotes["git"].branches[name].state< / code > can be set to
untracked. Untracked local branches won't be exported to Git.< / li >
2023-08-26 04:56:32 +00:00
< li > If < code > remotes["git"].branches[name]< / code > is < code > absent< / code > , the default
2023-09-28 09:01:21 +00:00
< code > state = tracking< / code > applies. This also applies to forgotten branches.< / li >
< li > ~< code > tags< / code > ~ (not implemented, but should be the same as < code > branches< / code > )
2. Calculates diff from the known < code > git_refs< / code > to the new < code > remotes[remote]< / code > .
3. Applies diff to the backing Git repo.
4. Updates < code > git_refs< / code > reflecting the export.< / li >
2023-08-26 04:56:32 +00:00
< / ul >
< / li >
< / ul >
2023-09-28 09:01:21 +00:00
< p > If a ref failed to export at the step 3, the preceding steps should also be
rolled back for that ref.< / p >
2023-08-28 17:58:36 +00:00
< h3 id = "initclone" > init/clone< a class = "headerlink" href = "#initclone" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li > < code > jj init< / code > < / li >
< li > Import, track, and merge per < code > git.auto_local_branch< / code > config.< / li >
< li >
< p > If < code > !git.auto_local_branch< / code > , no < code > tracking< / code > state will be set.< / p >
< / li >
< li >
< p > < code > jj git clone< / code > < / p >
< / li >
< li > Import, track, and merge per < code > git.auto_local_branch< / code > config.< / li >
< li > The default branch will be tracked regardless of < code > git.auto_local_branch< / code >
config. (Because local branch is created for the default remote branch,
it makes sense to track.)< / li >
< / ul >
2023-08-28 17:58:36 +00:00
< h3 id = "branch" > branch< a class = "headerlink" href = "#branch" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li > < code > jj branch set {name}< / code >
1. Sets local < code > branches[name]< / code > entry.< / li >
< li > < code > jj branch delete {name}< / code >
1. Removes local < code > branches[name]< / code > entry.< / li >
< li > < code > jj branch forget {name}< / code >
1. Removes local < code > branches[name]< / code > entry if exists.
2023-09-28 09:01:21 +00:00
2. Removes < code > remotes[remote].branches[name]< / code > entries if exist.
TODO: maybe better to not remove non-tracking remote branches?< / li >
2023-08-26 04:56:32 +00:00
< li > < code > jj branch track {name}@{remote}< / code > (new command)
1. Merges < code > [local, remote] - [absent]< / code > in local branch.< ul >
< li > Same as "fetching/importing existing branch from untracked remote".
2. Sets < code > remotes[remote].branches[name].state = tracking< / code > .< / li >
< / ul >
< / li >
< li > < code > jj branch untrack {name}@{remote}< / code > (new command)
1. Sets < code > remotes[remote].branches[name].state = new< / code > .< / li >
< li > < code > jj branch list< / code > < / li >
< li > TODO: hide non-tracking branches by default? ...< / li >
< / ul >
< p > Note: desired behavior of < code > jj branch forget< / code > is to
* discard both local and remote branches (without actually removing branches
at remotes)
* not abandon commits which belongs to those branches (even if the branch is
removed at a remote)< / p >
2023-08-28 17:58:36 +00:00
< h2 id = "command-behavior-examples" > Command behavior examples< a class = "headerlink" href = "#command-behavior-examples" title = "Permanent link" > ¶ < / a > < / h2 >
< h3 id = "fetchimport_1" > fetch/import< a class = "headerlink" href = "#fetchimport_1" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li > Fetching/importing new branch
1. Decides new < code > state = new|tracking< / code > based on < code > git.auto_local_branch< / code >
2. If new < code > state< / code > is < code > tracking< / code > , merges < code > [absent, new_remote] - [absent]< / code >
(i.e. creates local branch with < code > new_remote< / code > target)
3. Sets < code > remotes[remote].branches[name].state< / code > < / li >
< li > Fetching/importing existing branch from tracking remote
1. Merges < code > [local, new_remote] - [known_remote]< / code > < / li >
< li > Fetching/importing existing branch from untracked remote
1. Decides new < code > state = new|tracking< / code > based on < code > git.auto_local_branch< / code >
2. If new < code > state< / code > is < code > tracking< / code > , merges < code > [local, new_remote] - [absent]< / code >
3. Sets < code > remotes[remote].branches[name].state< / code > < / li >
< li > Fetching/importing remotely-deleted branch from tracking remote
1. Merges < code > [local, absent] - [known_remote]< / code >
2. Removes < code > remotes[remote].branches[name]< / code > (< code > target< / code > becomes < code > absent< / code > )
(i.e. the remote branch is no longer tracked)
3. Abandons commits in the deleted branch< / li >
< li > Fetching/importing remotely-deleted branch from untracked remote
1. Decides new < code > state = new|tracking< / code > based on < code > git.auto_local_branch< / code >
2. Noop anyway since < code > [local, absent] - [absent]< / code > -> < code > local< / code > < / li >
< li > Fetching previously-forgotten branch from remote
1. Decides new < code > state = new|tracking< / code > based on < code > git.auto_local_branch< / code >
2. If new < code > state< / code > is < code > tracking< / code > , merges
< code > [absent, new_remote] - [absent]< / code > -> < code > new_remote< / code >
3. Sets < code > remotes[remote].branches[name].state< / code > < / li >
< li > Fetching forgotten and remotely-deleted branch< / li >
2023-09-28 09:01:21 +00:00
< li > Same as "remotely-deleted branch from untracked remote" since forgotten
remote branch should be < code > state = new< / code > < / li >
2023-08-26 04:56:32 +00:00
< li > Therefore, no local commits should be abandoned< / li >
< / ul >
2023-09-28 09:01:21 +00:00
< h3 id = "push" > push< a class = "headerlink" href = "#push" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
2023-09-28 09:01:21 +00:00
< li > Pushing new branch, remote doesn't exist
1. Pushes < code > [local, absent] - [absent]< / code > -> < code > local< / code >
2023-08-26 04:56:32 +00:00
2. Sets < code > remotes[remote].branches[name].state = tracking< / code >
3. < code > import_refs()< / code > merges < code > [local, local] - [absent]< / code > -> < code > local< / code > (noop)< / li >
2023-09-28 09:01:21 +00:00
< li > Pushing new branch, untracked remote exists
1. Pushes < code > [local, remote] - [absent]< / code > < ul >
2023-08-26 04:56:32 +00:00
< li > Fails if < code > local< / code > moved backwards or sideways
2. Sets < code > remotes[remote].branches[name].state = tracking< / code >
3. < code > import_refs()< / code > merges < code > [local, local] - [remote]< / code > -> < code > local< / code > (noop)< / li >
< / ul >
< / li >
2023-09-28 09:01:21 +00:00
< li > Pushing existing branch to tracking remote
1. Pushes < code > [local, remote] - [remote]< / code > -> < code > local< / code > < ul >
2023-08-26 04:56:32 +00:00
< li > Fails if < code > local< / code > moved backwards or sideways, and if < code > remote< / code > is out of
sync
2. < code > import_refs()< / code > merges < code > [local, local] - [remote]< / code > -> < code > local< / code > (noop)< / li >
< / ul >
< / li >
2023-09-28 09:01:21 +00:00
< li > Pushing existing branch to untracked remote< / li >
2023-08-26 04:56:32 +00:00
< li > Same as "new branch"< / li >
2023-09-28 09:01:21 +00:00
< li > Pushing deleted branch to tracking remote
1. Pushes < code > [absent, remote] - [remote]< / code > -> < code > absent< / code > < ul >
2023-08-26 04:56:32 +00:00
< li > TODO: Fails if < code > remote< / code > is out of sync?
2. < code > import_refs()< / code > merges < code > [absent, absent] - [remote]< / code > -> < code > absent< / code >
3. Removes < code > remotes[remote].branches[name]< / code > (< code > target< / code > becomes < code > absent< / code > )< / li >
< / ul >
< / li >
2023-09-28 09:01:21 +00:00
< li > Pushing deleted branch to untracked remote< / li >
2023-08-26 04:56:32 +00:00
< li > Noop since < code > [absent, remote] - [absent]< / code > -> < code > remote< / code > < / li >
< li > Perhaps, UI will report error< / li >
< li > Pushing forgotten branch to untracked remote< / li >
< li > Same as "deleted branch to untracked remote"< / li >
< li > Pushing previously-forgotten branch to remote< / li >
< li > Same as "new branch, untracked remote exists"< / li >
2023-09-28 09:01:21 +00:00
< li > The < code > target< / code > of forgotten remote branch is < code > absent< / code > < / li >
< / ul >
< h3 id = "export" > export< a class = "headerlink" href = "#export" title = "Permanent link" > ¶ < / a > < / h3 >
< ul >
< li > Exporting new local branch, git branch doesn't exist
1. Sets < code > remotes["git"].branches[name].target = local< / code > , < code > .state = tracking< / code >
2. Exports < code > [local, absent] - [absent]< / code > -> < code > local< / code > < / li >
< li > Exporting new local branch, git branch is out of sync
1. Exports < code > [local, git] - [absent]< / code > -> fail< / li >
< li > Exporting existing local branch, git branch is synced
1. Sets < code > remotes["git"].branches[name].target = local< / code >
2. Exports < code > [local, git] - [git]< / code > -> < code > local< / code > < / li >
< li > Exporting deleted local branch, git branch is synced
1. Removes < code > remotes["git"].branches[name]< / code >
2. Exports < code > [absent, git] - [git]< / code > -> < code > absent< / code > < / li >
< li > Exporting forgotten branches, git branches are synced
1. Exports < code > [absent, git] - [git]< / code > -> < code > absent< / code > for forgotten local/remote
branches< / li >
< / ul >
< h3 id = "undo-fetch" > undo fetch< a class = "headerlink" href = "#undo-fetch" title = "Permanent link" > ¶ < / a > < / h3 >
< ul >
< li > Exporting undone fetch, git branches are synced
1. Exports < code > [old, git] - [git]< / code > -> < code > old< / code > for undone local/remote branches< / li >
< li > Redoing undone fetch without exporting< / li >
< li > Same as plain fetch since the known < code > git_refs< / code > isn't diffed against the
refs in the backing Git repo.< / li >
2023-08-26 04:56:32 +00:00
< / ul >
2023-08-28 17:58:36 +00:00
< h3 id = "git-remote" > < code > @git< / code > remote< a class = "headerlink" href = "#git-remote" title = "Permanent link" > ¶ < / a > < / h3 >
2023-08-26 04:56:32 +00:00
< ul >
< li > < code > jj branch untrack {name}@git< / code > < / li >
< li > Maybe rejected (to avoid confusion)?< / li >
< li > Allowing this would mean different local branches of the same name coexist
in jj and git.< / li >
< li > < code > jj git fetch --remote git< / code > < / li >
2023-09-28 09:01:21 +00:00
< li > Rejected. The implementation is different.< / li >
2023-08-26 04:56:32 +00:00
< li > Conceptually, it's < code > git::import_refs()< / code > only for local branches.< / li >
< li > < code > jj git push --remote git< / code > < / li >
2023-09-28 09:01:21 +00:00
< li > Rejected. The implementation is different.< / li >
2023-08-26 04:56:32 +00:00
< li > Conceptually, it's < code > jj branch track< / code > and < code > git::export_refs()< / code > only for
local branches.< / li >
< / ul >
2023-08-28 17:58:36 +00:00
< h2 id = "remaining-issues" > Remaining issues< a class = "headerlink" href = "#remaining-issues" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< ul >
< li > < code > git.auto_local_branch = false< / code > by default to help Git interop?< / li >
< li > https://github.com/martinvonz/jj/issues/1862< / li >
< li > https://github.com/martinvonz/jj/issues/1278 pushing to tracked remote< / li >
< li > Option could be added to push to all < code > tracking< / code > remotes?< / li >
< li > Track remote branch locally with different name< / li >
< li > Local branch name could be stored per remote branch< / li >
< li > Consider UI complexity< / li >
< li > "private" state (suggested by @ilyagr)< / li >
< li > "private" branches can be pushed to their own remote, but not to the
upstream repo< / li >
< li > This might be a state attached to a local branch (similar to Mercurial's
"secret" phase)< / li >
< / ul >
2023-08-28 17:58:36 +00:00
< h2 id = "references" > References< a class = "headerlink" href = "#references" title = "Permanent link" > ¶ < / a > < / h2 >
2023-08-26 04:56:32 +00:00
< ul >
< li > https://github.com/martinvonz/jj/issues/1136< / li >
< li > https://github.com/martinvonz/jj/issues/1666< / li >
< li > https://github.com/martinvonz/jj/issues/1690< / li >
< li > https://github.com/martinvonz/jj/issues/1734< / li >
< li > https://github.com/martinvonz/jj/pull/1739< / li >
< / ul >
< / article >
< / div >
< / 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 >
2023-10-03 03:41:01 +00:00
< script id = "__config" type = "application/json" > { "base" : "../.." , "features" : [ ] , "search" : "../../assets/javascripts/workers/search.dfff1995.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 >
2023-08-26 04:56:32 +00:00
2023-10-03 03:41:01 +00:00
< script src = "../../assets/javascripts/bundle.78eede0e.min.js" > < / script >
2023-08-26 04:56:32 +00:00
< / body >
< / html >