Skip to content

Commit 187be6f

Browse files
committed
Adding new files referenced by gitconfig
1 parent 64a0408 commit 187be6f

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

git-getm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
cur_dir=$(pwd);
4+
branch_name="master";
5+
6+
if [[ $cur_dir == *-ee-* ]]; then
7+
repo_path=$(echo $cur_dir | sed -E 's#-ee-([^/]+)/.*#-ee-\1#')
8+
cur_dir="${cur_dir#*ee-}"
9+
cur_dir="ee-${cur_dir%%/*}"
10+
git show-ref --quiet "$cur_dir" && branch_name="$cur_dir"
11+
[[ -f "$repo_path/.git/refs/heads/$cur_dir" ]] && branch_name="$cur_dir"
12+
fi;
13+
14+
echo $branch_name

git-of-interest

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
file_types=${2:-"*.js *.css *.jsp* *.vm *.ftl"}
4+
5+
ignore_folder="portal-web/test/"
6+
7+
to_rev=${1:-"HEAD"};
8+
old_head=${to_rev}^;
9+
new_head=$to_rev;
10+
11+
if [[ $to_rev == *..* ]]; then
12+
old_head=${to_rev%%..*};
13+
new_head=${to_rev#*..*};
14+
fi
15+
16+
ref_spec=$old_head..$new_head;
17+
18+
entries=$(git log -M -C --name-only --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative $ref_spec -- $file_types | sed 's/^/ /')
19+
20+
totalstat=$(git diff --numstat --pretty='%H' --no-renames $ref_spec | grep -v "\b$ignore_folder" | xargs -0n1 echo -n | awk '{{print $3}}' | sed -e 's/^.*\.\(.*\)$/\1/' | sort | uniq -c | tr '\n' ',' | sed 's/,$//')
21+
22+
if [[ -z $entries ]]; then
23+
echo "There are no changes in ${file_types// /, } across $ref_spec"
24+
else
25+
echo "Changes in these file types: ${file_types// /, } that you might be interested in:"
26+
27+
echo "$entries"
28+
echo "---"
29+
echo "$totalstat"
30+
fi

git-sync-origin

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
old_head=$(git rev-parse --short head | tr -d '\n')
4+
5+
msg=$(git stash save)
6+
7+
[[ $msg =~ ^'No local changes to save'$ ]] && stashed=0 || stashed=1
8+
9+
git fetch upstream && git merge upstream/$1 --ff-only && git push origin $1
10+
11+
new_head=$(git rev-parse --short head | tr -d '\n')
12+
13+
[ $old_head != $new_head ] && updated=1 || updated=0
14+
15+
if [[ $stashed == 1 ]]; then
16+
git stash pop > /dev/null
17+
fi
18+
19+
if [[ $updated == 1 ]]; then
20+
echo "Updated from $old_head to $new_head ($old_head..$new_head)"
21+
echo "---------------------------------------------------"
22+
23+
git of-interest $old_head..$new_head
24+
25+
echo "---------------------------------------------------"
26+
echo "Updated from $old_head to $new_head ($old_head..$new_head)"
27+
fi

0 commit comments

Comments
 (0)