Revert "Add git-squash-merge script"

This reverts commit 150182149a.
This commit is contained in:
Oliver Davies 2024-11-26 08:09:03 +00:00
parent 150182149a
commit 7973d6ebad
3 changed files with 1 additions and 45 deletions

View file

@ -146,10 +146,7 @@
}; };
}; };
home.packages = with pkgs; [ home.packages = [ pkgs.git-instafix ];
git-instafix
git-squash-merge
];
home.sessionVariables = { home.sessionVariables = {
GIT_INSTAFIX_UPSTREAM = "origin/main"; GIT_INSTAFIX_UPSTREAM = "origin/main";

View file

@ -5,7 +5,6 @@ let
in in
{ {
build-glove80 = callPackage ./build-glove80.nix { }; build-glove80 = callPackage ./build-glove80.nix { };
git-squash-merge = callPackage ./git-squash-merge.nix { };
vimPlugins = prev.vimPlugins // { vimPlugins = prev.vimPlugins // {
conf-vim = callPackage ./vim-plugins/conf-vim.nix { }; conf-vim = callPackage ./vim-plugins/conf-vim.nix { };

View file

@ -1,40 +0,0 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "git-squash-merge";
runtimeInputs = with pkgs; [
bashInteractive
coreutils
git
];
text = ''
branch_to_merge=$1
target_branch=''${2:-main}
if [[ -z "$branch_to_merge" ]]; then
echo "Usage: $0 <branch-to-merge> [target-branch]"
exit 1
fi
if ! git checkout "$target_branch"; then
echo "Error: Failed to checkout target branch '$target_branch'."
exit 1
fi
if ! git merge --squash "$branch_to_merge"; then
echo "Error: Squash merge from '$branch_to_merge' to '$target_branch' failed."
exit 1
fi
squashed_commit_messages=$(git log "$target_branch..$branch_to_merge" --reverse --pretty=format:"%h %s%n%b%n")
temp_file=$(mktemp)
echo -e "$squashed_commit_messages" > "$temp_file"
GIT_COMMIT_EDITMSG="$temp_file" git commit --edit
rm -f "$temp_file"
'';
}