Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3e0db84c88c57e70ac8be8c196dfa92c5d656fbc
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d205234cb05a5e330c0f7f5b3ea764533a74d69e
Choose a head ref
  • 9 commits
  • 18 files changed
  • 2 contributors

Commits on Jan 8, 2026

  1. Merge branch 'kh/replay-invalid-onto-advance' into ps/history

    * kh/replay-invalid-onto-advance:
      t3650: add more regression tests for failure conditions
      replay: die if we cannot parse object
      replay: improve code comment and die message
      replay: die descriptively when invalid commit-ish is given
      replay: find *onto only after testing for ref name
      replay: remove dead code and rearrange
    gitster committed Jan 8, 2026
    Configuration menu
    Copy the full SHA
    f42d7c9 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2026

  1. builtin/replay: extract core logic to replay revisions

    We're about to move the core logic used to replay revisions onto a new
    base into the "libgit.a" library. Prepare for this by pulling out the
    logic into a new function `replay_revisions()` that:
    
      1. Takes a set of revisions to replay and some options that tell it how
         it ought to replay the revisions.
    
      2. Replays the commits.
    
      3. Records any reference updates that would be caused by replaying the
         commits in a structure that is owned by the caller.
    
    The logic itself will be moved into a separate file in the next commit.
    This change is not expected to cause user-visible change in behaviour.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    1454743 View commit details
    Browse the repository at this point in the history
  2. builtin/replay: move core logic into "libgit.a"

    Move the core logic used to replay commits into "libgit.a" so that it
    can be easily reused by other commands. It will be used in a subsequent
    commit where we're about to introduce a new git-history(1) command.
    
    Note that with this change we have no sign-comparison warnings anymore,
    and neither do we depend on `the_repository`.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    6aeda3c View commit details
    Browse the repository at this point in the history
  3. replay: small set of cleanups

    Perform a small set of cleanups so that the "replay" logic compiles with
    "-Wsign-compare" and doesn't use `the_repository` anymore. Note that
    there are still some implicit dependencies on `the_repository`, e.g.
    because we use `get_commit_output_encoding()`.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    410e378 View commit details
    Browse the repository at this point in the history
  4. replay: support empty commit ranges

    In a subsequent commit we're about to introduce a new user of the replay
    subsystem. With that new user, the range of commits that we'll want to
    replay will be identified implicitly via a single commit, and will
    include all descendants of that commit to any branch. If that commit has
    no descendants (because it's the tip of some branch), then the range of
    revisions that we're asked to replay becomes empty. This case does not
    make sense with git-replay(1), but with the new command it will.
    
    This case is not currently supported by `replay_revisions()` though
    because we zero-initialize `struct merge_result`. This includes its
    `.clean` member, which indicates whether the merge ran into a conflict
    or not. But given that we don't have any revision to replay, we won't
    ever perform any merge at all, and consequently that member will never
    be set to `1`. We thus later think that there's been a merge conflict
    and return an error from `replay_commits()`.
    
    Address this issue by initializing the `.clean` member to `1`.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    5425771 View commit details
    Browse the repository at this point in the history
  5. replay: support updating detached HEAD

    In a subsequent commit we're about to introduce a new git-history(1)
    command, which will by default work on all local branches and HEAD. This
    is already well-supported by the replay machinery for most of the part:
    updating branches is one of its prime use cases, and the HEAD ref is
    also updated in case it points to any of the branches.
    
    However, what's not supported yet is to update HEAD in case it is not a
    symbolic ref. We determine the refs that need to be updated by iterating
    through the decorations of the original commit, but we only update those
    refs that are `DECORATION_REF_LOCAL`, which covers local branches.
    
    Address this gap by also handling `DECORATION_REF_HEAD`. Note though
    that this needs to only happen in case we're working on a detached HEAD.
    If HEAD is pointing to a branch, then we'd already update that branch
    via `DECORATION_REF_LOCAL`.
    
    Refactor the loop that iterates through the decorations a bit to make
    the individual conditions easier to understand.
    
    Based-on-patch-by: Elijah Newren <newren@gmail.com>
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    48a72f6 View commit details
    Browse the repository at this point in the history
  6. wt-status: provide function to expose status for trees

    The "wt-status" subsystem is responsible for printing status information
    around the current state of the working tree. This most importantly
    includes information around whether the working tree or the index have
    any changes.
    
    We're about to introduce a new command where the changes in neither of
    them are actually relevant to us. Instead, what we want is to format the
    changes between two different trees. While it is a little bit of a
    stretch to add this as functionality to _working tree_ status, it
    doesn't make any sense to open-code this functionality, either.
    
    Implement a new function `wt_status_collect_changes_trees()` that diffs
    two trees and formats the status accordingly. This function is not yet
    used, but will be in a subsequent commit.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    475ade1 View commit details
    Browse the repository at this point in the history
  7. builtin: add new "history" command

    When rewriting history via git-rebase(1) there are a few very common use
    cases:
    
      - The ordering of two commits should be reversed.
    
      - A commit should be split up into two commits.
    
      - A commit should be dropped from the history completely.
    
      - Multiple commits should be squashed into one.
    
      - Editing an existing commit that is not the tip of the current
        branch.
    
    While these operations are all doable, it often feels needlessly kludgey
    to do so by doing an interactive rebase, using the editor to say what
    one wants, and then perform the actions. Also, some operations like
    splitting up a commit into two are way more involved than that and
    require a whole series of commands.
    
    Rebases also do not update dependent branches. The use of stacked
    branches has grown quite common with competing version control systems
    like Jujutsu though, so it clearly is a need that users have. While
    rebases _can_ serve this use case if one always works on the latest
    stacked branch, it is somewhat awkward and very easy to get wrong.
    
    Add a new "history" command to plug these gaps. This command will have
    several different subcommands to imperatively rewrite history for common
    use cases like the above.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    a675183 View commit details
    Browse the repository at this point in the history
  8. builtin/history: implement "reword" subcommand

    Implement a new "reword" subcommand for git-history(1). This subcommand
    is similar to the user performing an interactive rebase with a single
    commit changed to use the "reword" instruction.
    
    The "reword" subcommand is built on top of the replay subsystem
    instead of the sequencer. This leads to some major differences compared
    to git-rebase(1):
    
      - We do not check out the commit that is to be reworded and instead
        perform the operation in-memory. This has the obvious benefit of
        being significantly faster compared to git-rebase(1), but even more
        importantly it allows the user to rewrite history even if there are
        local changes in the working tree or in the index.
    
      - We do not execute any hooks, even though we leave some room for
        changing this in the future.
    
      - By default, all local branches that contain the commit will be
        rewritten. This especially helps with workflows that use stacked
        branches.
    
    Helped-by: Elijah Newren <newren@gmail.com>
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    d205234 View commit details
    Browse the repository at this point in the history
Loading