Skip to main content

sync_to_head

Function sync_to_head 

Source
pub async fn sync_to_head(worktree: &Path) -> Result<()>
Expand description

Bring an attached worktree’s index and files in line with wherever its branch now points.

rebase_branch_in_temp moves a branch from a throwaway worktree on purpose - the whole point is never touching the tree someone else has checked out. But a worktree that already had that branch checked out shares the same ref: its HEAD resolves to the new commit the moment the rebase lands elsewhere, while its index and working directory keep whatever the old commit put there until something says otherwise. Left alone, the next git status there reads as the whole rebase turning up as an unstaged diff, and the next commit would be staged against stale content.