Commit f6ff8b722897

Vincent Demeester <vincent@sbr.pm>
2026-02-25 11:19:08
feat(lazygit): fetch all remotes and prefer upstream for sync
Updated sync keybinding to fetch from all remotes and rebase from upstream when available, falling back to origin otherwise. Push always targets origin for fork workflows.
1 parent 7bf3417
Changed files (1)
dots
config
lazygit
dots/config/lazygit/config.yml
@@ -39,11 +39,11 @@ keybinding:
     select: "s"
 
 customCommands:
-  # Sync: fetch + rebase + push current branch
+  # Sync: fetch all + rebase (from upstream if exists, else origin) + push
   - key: ";"
     description: "Sync Pull/Push"
     context: "global"
-    command: "git fetch {{.CheckedOutBranch.UpstreamRemote}} && git rebase {{.CheckedOutBranch.UpstreamRemote}}/{{.CheckedOutBranch.Name}} && git push {{.CheckedOutBranch.UpstreamRemote}} {{.CheckedOutBranch.Name}}"
+    command: "git fetch --all && REBASE_REMOTE=$(git remote | grep -q upstream && echo upstream || echo origin) && git rebase $REBASE_REMOTE/{{.CheckedOutBranch.Name}} && git push origin {{.CheckedOutBranch.Name}}"
     loadingText: "Syncing...."
     output: popup