-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-output-diff.sh
More file actions
executable file
·34 lines (25 loc) · 934 Bytes
/
dev-output-diff.sh
File metadata and controls
executable file
·34 lines (25 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# 1. Take the feature branch as the first param
feature_branch=$1
# 2. Take the google doc id as the second param
google_doc_id=$2
# 3. Save current branch
current_branch=$(git branch --show-current)
# 4. Check out the main git branch
git checkout main
# 5. Run the node devtool.js command and store the result
main_output=$(node devtools.js md $google_doc_id)
main_output_file=$(mktemp)
echo "$main_output" > "$main_output_file"
echo "Branch 'main' outputs $main_output_file"
# 6. Check out the feature branch
git checkout $feature_branch
# 7. Run the same node command
branch_output=$(node devtools.js md $google_doc_id)
branch_output_file=$(mktemp)
echo "$branch_output" > "$branch_output_file"
echo "Branch $feature_branch outputs $main_output_file"
# 8. Output a git diff of the two command runs
git diff "$main_output_file" "$branch_output_file"
# 9. Return to initial branch
git checkout $current_branch