cucumber/polyglot-release

Check for un-*pulled* git commits

Closed this issue · 0 comments

🤔 What's the problem you're trying to solve?

Today I was about to release a repo where I'd been merging some PRs via GitHub. I instinctively ran git status and saw this:

On branch main
Your branch is behind 'origin/main' by 2 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean

I tried running the command we use in our check_git_index_clean and it didn't pick anything up:

> multi_test git:(main) git diff-index --quiet HEAD
> echo $?
0

✨ What's your proposed solution?

Add a pre-flight check for this scenario.

I guess we'd also want to run git fetch origin to ensure we had clear sight of all the commits on the remote before we check.

⛏ Have you considered any alternatives or workarounds?

I guess we'd end up getting a failure anyway when we try to push our commits to main at the end, so we could roll back our "transaction" at that point (i.e. delete the commits we've made to main) and print en error to the user, telling them to sort it out by hand.


This text was originally generated from a template, then edited by hand. You can modify the template here.