nix-config/.hooks/post-merge

18 lines
585 B
Text
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i bash ../shell.nix
# Get current branch name
current_branch=$(git branch --show-current)
# Only restore stash if we're on main branch and a merge just completed
if [ "$current_branch" = "main" ]; then
# Check if there are any stashes to restore
if git stash list | grep -q "stash@"; then
echo "Post-merge: restoring stashed changes on main branch"
git stash pop -q
else
echo "Post-merge: no stash to restore on main branch"
fi
else
echo "Post-merge: no action needed on branch '$current_branch'"
fi