File tree Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # git-echo
3
+ # From repo https://github.com/wilsonmar/git-utilities
4
+ # A test program for git custom commands
5
+ # Usage: git echo hello
6
+ echo $1
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # git-squash
3
+ # From https://coderwall.com/p/bt93ia/extend-git-with-custom-commands
4
+ # Usage: git squash 3
5
+ # squashes the last 3 commits (HEAD~3)
6
+
7
+ source " $( git --exec-path) /git-sh-setup"
8
+
9
+ USAGE=" COMMITS"
10
+ function _squash() {
11
+ if [[ $# == 1 ]]; then
12
+ if [[ -n $( git rev-parse --verify --quiet HEAD~$1 ) ]]; then
13
+ git rebase -i HEAD~$1
14
+ else
15
+ die " HEAD~$1 does not exist"
16
+ fi
17
+ else
18
+ usage
19
+ fi
20
+ }
21
+
22
+ _squash $1
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # graph-dag.sh
3
+ # Draw a graphviz diagram of the Git DAG
4
+ # See https://wilsonmar.github.io/git-utilities
5
+ #
6
+ # Labels consist of the short SHA1 and any refs.
7
+ # Unreachable commits (ignoring the reflog) will be marked with an asterisk and
8
+ # drawn with dashed lines.
9
+ #
10
+ # Largely stolen from https://git.wiki.kernel.org/index.php/ExampleScripts
11
+ #
12
+ # Usage:
13
+ # git graph-dag HEAD~10.. | dot -Tpng | display -antialias
14
+ #
15
+ # Accepts any range or arguments that git rev-list accepts.
16
+
17
+ set -e
18
+
19
+ if [[ -z $@ ]] ; then
20
+ echo -e " Usage: git graph-dag HEAD~10.. | dot -Tpng | display -antialias"
21
+ exit 1
22
+ fi
23
+
24
+ echo " digraph lattice {"
25
+
26
+ # Draw the DAG and connect parents
27
+ git rev-list --parents " $@ " |
28
+ while read commit parents
29
+ do
30
+ for p in $parents
31
+ do
32
+ echo " n$commit -> n$p "
33
+ done
34
+ done
35
+
36
+ # Make pretty labels with the short sha1 and any refs
37
+ git rev-list --pretty=format:" %H %h %d" " $@ " | awk '
38
+ BEGIN {
39
+ command = "git fsck --unreachable --no-reflogs | cut -d\" \" -f3"
40
+ while (command | getline unr) unreachable[unr] = 1
41
+ close(command)
42
+ }
43
+
44
+ !/^commit/ {
45
+ refs = ""
46
+ for (i=3; i<=NF; i++) refs = refs " " $i
47
+
48
+ unreachable[$1] == 1 ? isunr = 1 : isunr = 0
49
+
50
+ printf "n%s [shape=Mrecord, style=%s, label=\"{%s%s}\"]\n", \
51
+ $1, \
52
+ isunr == 1 ? "dashed" : "filled", \
53
+ isunr == 1 ? "*" $2 : $2, \
54
+ refs == "" ? "" : refs
55
+ }'
56
+
57
+ echo " }"
You can’t perform that action at this time.
0 commit comments