Added gitconfig
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
|||||||
|
[user]
|
||||||
|
name = Simon Gruber
|
||||||
|
[fetch]
|
||||||
|
prune = true
|
||||||
|
[http]
|
||||||
|
sslbackend = openssl
|
||||||
|
[core]
|
||||||
|
autocrlf = true
|
||||||
|
excludesfile = D:\\Users\\Simon.Gruber\\Documents\\gitignore_global.txt
|
||||||
|
[push]
|
||||||
|
autoSetupRemote = true
|
||||||
|
[init]
|
||||||
|
defaultbranch = main
|
||||||
|
[advice]
|
||||||
|
skippedCherryPicks = false
|
||||||
|
[pull]
|
||||||
|
ff = only
|
||||||
|
[alias]
|
||||||
|
branches = !sh scripts/git-branches
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: git branches [-f FILTER] ACTION"
|
||||||
|
echo " -f FILTER Optional branch name filter (default: '*')"
|
||||||
|
echo " ACTION Command to execute for each branch"
|
||||||
|
echo " The current branch name is available via variable 'b' or 'branch'"
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " git branches -f 'feature/*' 'echo Processing branch: \$b'"
|
||||||
|
echo " git branches 'git push origin \$branch'"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default filter
|
||||||
|
filter='*'
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-f)
|
||||||
|
filter="*$2*"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
action="$1"
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$action" ]; then
|
||||||
|
echo "No action provided"
|
||||||
|
echo
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git branch --list "${filter}" --format='%(refname:short)' | while read -r branch; do
|
||||||
|
b="$branch" eval "$action"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user