-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus
executable file
·30 lines (26 loc) · 861 Bytes
/
status
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
#!/usr/bin/env bash
places=(".cfg" ".nix" "scripts" "knowledge-base" ".password-store")
for place in "${places[@]}"; do
if [ -d "$HOME/$place" ]; then
pushd "$HOME/$place" > /dev/null
echo "Updating remote for ~/$place"
git remote update
popd > /dev/null
fi
done
echo
for place in "${places[@]}"; do
if [ -d "$HOME/$place" ]; then
pushd "$HOME/$place" > /dev/null
if [[ ! -z "$(git status --porcelain)" ]]; then
echo "Uncommitted changes in ~/$place:"
git status -s
fi
if [[ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]]; then
branch=$(git rev-parse --abbrev-ref HEAD)
upstream=$(git rev-parse --abbrev-ref @{u})
echo "~/$place: $branch is out of sync with $upstream."
fi
popd > /dev/null
fi
done