Skip to content

How does gitbutler support multiple open branches on the same repo? #2721

Answered by schacon
c-antin asked this question in Q&A
Discussion options

You must be logged in to vote

I'll try to do a longer blog post on the internals of this (been working on one for a while now), but the general idea is:

  • We run a git diff between your working directory and your "base branch" (so, something like origin/master)
  • Anything that is different comes back as a series of hunks in diff format (lines changed)
  • We keep a list of which virtual branch each hunk "belongs" to (ownership)
  • The next time we run a git diff, if the hunks have changed, we try to keep ownership where it was before as much as possible. New hunks we havent seen before go into a default branch (you select in the UI)
  • If you drag a file or hunk to a new lane, we rewrite the ownership data so that hunk now "belong…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by c-antin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants