Skip to content

Instantly share code, notes, and snippets.

@werner
Created October 8, 2020 14:33
Show Gist options
  • Save werner/1a7dd8773d9731f172fc4732a6682bd9 to your computer and use it in GitHub Desktop.
Save werner/1a7dd8773d9731f172fc4732a6682bd9 to your computer and use it in GitHub Desktop.
Figure it out if the branch I'm working on is updated to master remote
local_commit = `git rev-parse HEAD`
raw_remote_commit = `git ls-remote --heads --quiet`
remote_commit = raw_remote_commit.split(/\s/)[0].strip
search_in_commits = `git log | grep #{remote_commit}`
puts 'Branch not merged with master' if search_in_commits == ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment