Skip to content

Commit

Permalink
refactor: simplify the git parent command (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgokcin authored Nov 22, 2024
1 parent c98397f commit ce026a5
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions base.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,7 @@
dc = "!git diff --staged | pbcopy"

# Get the parent branch of the current branch
parent = "!f() { \
branch=$(git symbolic-ref --short HEAD); \
if [[ $branch =~ ^(main|master|develop)$ ]]; then \
echo \"You're already on a main branch: $branch\"; \
else \
parent_branch=$(git for-each-ref --format='%(refname:short)' refs/heads/ | grep -E '^(main|master|develop)' | head -n 1); \
if [ -z \"$parent_branch\" ]; then \
echo \"No common parent branch (main/master/develop) found.\"; \
else \
echo \"$parent_branch\"; \
fi; \
fi; \
}; f"
parent = "!git for-each-ref --format='%(refname:short)' refs/heads/ | grep -E '^(main|master|develop)' | head -n 1"

# List contributors with number of commits
contributors = shortlog --summary --numbered
Expand Down

0 comments on commit ce026a5

Please sign in to comment.