Currently, this tool hardcodes the usage of master as the upstream branch, which can often not be the case.
https://github.com/azz/pretty-quick/blob/master/src/scms/git.js#L31-L37
const revision = staged
? 'HEAD'
: runGit(directory, [
'merge-base',
'HEAD',
branch || 'master',
]).stdout.trim();
You can potentially provide better user experience by first checking if the user has configured a different default branch for their repos: git config --get init.defaultbranch, if that returns a value, then use that value, otherwise, use master (or if you wanna be progressive, main, but that'd be a breaking change — n.b., GitHub has published intent to change the default branch to always be main not master: https://github.com/github/renaming )
Currently, this tool hardcodes the usage of
masteras the upstream branch, which can often not be the case.https://github.com/azz/pretty-quick/blob/master/src/scms/git.js#L31-L37
You can potentially provide better user experience by first checking if the user has configured a different default branch for their repos:
git config --get init.defaultbranch, if that returns a value, then use that value, otherwise, usemaster(or if you wanna be progressive,main, but that'd be a breaking change — n.b., GitHub has published intent to change the default branch to always bemainnotmaster: https://github.com/github/renaming )