Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Last active July 22, 2020 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ORESoftware/2a19ee2c943586006be59c2fb6460670 to your computer and use it in GitHub Desktop.
Save ORESoftware/2a19ee2c943586006be59c2fb6460670 to your computer and use it in GitHub Desktop.
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