~/dev/boxen tmp
❯ np patch --any-branch
✔ Prerequisite check
❯ Git
✔ Check local working tree
✖ Check remote history
Cleanup
Installing dependencies
Running tests
Bumping version
Publishing package
Pushing tags
Command failed: git rev-list --count --left-only @{u}...HEAD
fatal: no upstream configured for branch 'tmp'
The above should not fail. The task should just be marked as skipped.
itaisteinherz earned $60.00 by resolving this issue!
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on Issuehunt to raise funds.
@sindresorhus you could also default upstream to master.
git branch --set-upstream-to=origin/master master
@sindresorhus What happens if you push the changes to git without upstream? Does it work?
@SamVerschueren No:
❯ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
@DylanPiercey I don't want to default to master. Let's say I have a local repo with no upstream, that I want to publish to a private npm account.
@sindresorhus So this means that the git push should also be skipped?
Hmm, yeah. Maybe this is too much of an edge-case?
Let's say I have a local repo with no upstream, that I want to publish to a private npm account.
If that is your use case and this would fix it, don't see any problem of adding that check.
IMO, if we do this, we should guard against accidental use in some way.
I can totally see myself cranking out a quick small module and forgetting to setup the GH repo.
We could either:
--force flag be used (or similar).Did any resolution come out of this?
I am facing the same issue while trying to push from my branch plugins to a prerelease 1.0.0-alpha.1:
✔ Prerequisite check
❯ Git
✔ Check local working tree
✖ Check remote history
→ fatal: no upstream configured for branch 'plugins'
I do have a master and use that for the stable versions, while I am using the branches for prereleases. This way any big bug can be fixed easily and quickly from master (master is always clean and production ready), while I can experiment in my branch and publish minor versions for testing. But unfortunately with this bug I cannot use np, is there any workaround?
Using:
np --any-branch
Hopefully I didn't break anything, but this was fixed on my case with:
git branch --set-upstream-to origin/plugins
Since I am pushing from the local branch plugins I think this makes sense.
@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt
@sindresorhus how about a --no-push flag to skip git push?
Another way of handling this could be to prompt the user, asking whether they'd prefer to skip the push step or enter a branch name that would later be used for pushing.
@Norris1z Adding a new flag should be the last option. We don't add flags lightly. Better to find a way to handle it automatically.
Another way of handling this could be to prompt the user, asking whether they'd prefer to skip the push step or enter a branch name that would later be used for pushing.
I don't think prompting is worth it here. Not having an upstream might be intentional. I think skipping is better. If the user really wants to push, they should just set an upstream.
@itaisteinherz has submitted a pull request. See it on IssueHunt
@sindresorhus has rewarded $54.00 to @itaisteinherz. See it on IssueHunt
Most helpful comment
@sindresorhus you could also default upstream to master.