Skip to content

Instantly share code, notes, and snippets.

@ORESoftware

ORESoftware/ubuntu.md

Last active Jul 22, 2020
Embed
What would you like to do?
how to tell yourself when you need to merge with master / integration when you are working on a feature branch

this will work on linux where notify-send is installed

throw this snippet into ~/.bashrc

((

    branch_name=dev

    if ! git rev-parse --verify dev 2> /dev/null; then
	branch_name=master
    fi

	fetch_output="$(git fetch origin "$branch_name" 2> /dev/null)"

	if [[ -n "$fetch_output" ]]; then
	   notify-send  \
		--urgency=CRITICAL 'git merge info' "You may need to merge with the upstream for repo: '$(pwd)'"
	fi
	

) &> /dev/null & ) &> /dev/null 

the default integration branch is "dev", if "dev" doesnt exist we fallback to master. It will send a notification to the desktop if there are new commits that haven't been fetched before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment