Add function to check for unpushed repos

This commit is contained in:
flyingscorpio@arch-desktop 2021-09-09 22:08:24 +02:00
parent 8a51cebd9a
commit 1cdc686fbe

View file

@ -117,6 +117,19 @@ pull_from_repos() {
cd "$start_dir" || exit 1
}
check_unpushed() {
local start_dir="$PWD"
local git_repos=($(find ~ -name .git -type d -not -path '*/.vim/*' -and -not -path '*/.local/*' -and -not -path '*/builds/*' -exec dirname {} \;))
for repo in "${git_repos[@]}"; do
cd "$repo" || exit 1
local unpushed=$(git log --pretty=format:'%h' '@{u}..' | wc -c)
if [ "$unpushed" -ne 0 ]; then
echo "Unpushed changes in $repo"
fi
done
cd "$start_dir" || exit 1
}
hello() {
if command -v protonvpn >/dev/null 2>&1; then
sudo protonvpn c --cc NL