Skip to content

Commit

Permalink
Merge pull request #291 from himkt/git-remove-merged
Browse files Browse the repository at this point in the history
misc(git): define remove-merged-branches directly in config
  • Loading branch information
himkt authored Jan 2, 2025
2 parents f0f7f26 + 0103b94 commit 598c25b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
15 changes: 0 additions & 15 deletions bin/remove-merged-branches

This file was deleted.

14 changes: 13 additions & 1 deletion git/config.d/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@
rebase = false

[alias]
remove-merged = !remove-merged-branches
remove-merged = "!f() { \
if [ -n \"$1\" ]; then \
BRANCH=\"$1\"; \
else \
BRANCH=$(git branch | awk '{print $NF}' | fzf --prompt '(base branch) > '); \
fi; \
if [ -z \"$BRANCH\" ]; then \
echo \"Select valid branch\"; \
exit 1; \
fi; \
echo \"Log: base branch: $BRANCH\"; \
git branch --merged \"$BRANCH\" | grep -v \"$BRANCH\" | xargs -r git branch -d; \
}; f"

[format]
pretty = format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]
Expand Down

0 comments on commit 598c25b

Please sign in to comment.