From 651bef9a2a03da3e8afcd11f091f25651fcee588 Mon Sep 17 00:00:00 2001 From: Francis Hamel <36383308+francishamel@users.noreply.github.com> Date: Sat, 14 Dec 2024 00:11:49 -0500 Subject: [PATCH 1/3] Ensure to always prune remote when fetching --- home-manager/modules/git.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home-manager/modules/git.nix b/home-manager/modules/git.nix index 60e36f1..dc21541 100644 --- a/home-manager/modules/git.nix +++ b/home-manager/modules/git.nix @@ -16,6 +16,7 @@ }; enable = true; extraConfig = { + fetch.prune = true; init.defaultBranch = "main"; merge.conflictstyle = "zdiff3"; pull.rebase = true; From a1519394afcbd2cc8d93947a041b7900c19f2eb4 Mon Sep 17 00:00:00 2001 From: Francis Hamel <36383308+francishamel@users.noreply.github.com> Date: Sat, 14 Dec 2024 00:12:06 -0500 Subject: [PATCH 2/3] Always update refs when rebasing --- home-manager/modules/git.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home-manager/modules/git.nix b/home-manager/modules/git.nix index dc21541..451a63b 100644 --- a/home-manager/modules/git.nix +++ b/home-manager/modules/git.nix @@ -23,6 +23,7 @@ rebase = { autoStash = true; autosquash = true; + updateRefs = true; }; rerere.enabled = true; }; From 460efcbed034c016d00a7c4369d81e5c822e820b Mon Sep 17 00:00:00 2001 From: Francis Hamel <36383308+francishamel@users.noreply.github.com> Date: Sat, 14 Dec 2024 00:12:48 -0500 Subject: [PATCH 3/3] Always setup remote on push + always use force if includes This ensures safer force pushing --- home-manager/modules/git.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home-manager/modules/git.nix b/home-manager/modules/git.nix index 451a63b..909d6e2 100644 --- a/home-manager/modules/git.nix +++ b/home-manager/modules/git.nix @@ -20,6 +20,10 @@ init.defaultBranch = "main"; merge.conflictstyle = "zdiff3"; pull.rebase = true; + push = { + autoSetupRemote = true; + useForceIfIncludes = true; + }; rebase = { autoStash = true; autosquash = true;