question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fatal: bad revision 'undefined'

See original GitHub issue

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

https://github.com/bluelovers/ws-dot-properties

  1. lerna publish
lerna.json

{
  "packages": [
    "packages/*"
  ],
  "command": {
    "publish": {
      "ignoreChanges": [
        "**/node_modules/**",
        "**/__snapshots__/**",
        "**/__fixtures__/**",
        "**/test/**",
        "**/__tests__/**",
        "*.map",
        "*.spec.*",
        "*.test.*",
        ".gitrepo"
      ],
      "message": "chore(release): publish",
      "bump": "patch",
      "conventionalCommits": true,
      "conventionalGraduate": true
    },
    "run": {
      "stream": true
    },
    "exec": {
      "stream": true
    }
  },
  "npmClient": "yarn",
  "useWorkspaces": true,
  "version": "independent"
}

lerna-debug.log

23 error Error: Command failed: git diff --name-only  -- packages/dot-properties-loader
23 error fatal: bad revision 'undefined'
23 error
23 error
23 error     at makeError (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\execa\index.js:174:9)
23 error     at Function.module.exports.sync (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\execa\index.js:338:15)
23 error     at Object.execSync (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\child-process\index.js:26:16)
23 error     at diffSinceIn (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\lib\make-diff-predicate.js:63:23)
23 error     at hasDiffSinceThatIsntIgnored (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\lib\make-diff-predicate.js:27:18)
23 error     at isCandidate (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\collect-updates.js:88:77)
23 error     at C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\lib\collect-packages.js:11:9
23 error     at Map.forEach (<anonymous>)
23 error     at collectPackages (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\lib\collect-packages.js:10:12)
23 error     at collectUpdates (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\collect-updates\collect-updates.js:87:10)
23 error     at VersionCommand.initialize (C:\Users\User\AppData\Roaming\npm\node_modules\lerna\node_modules\@lerna\version\index.js:188:20)

Context

Your Environment

Executable Version
lerna --version 3.20.2
npm --version 6.14.4
yarn --version 1.22.0
node --version v13.12.0
OS Version
NAME VERSION

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:7

github_iconTop GitHub Comments

10reactions
Lornz-commented, Apr 14, 2020

@bluelovers I got the same issue when I try to publish on merging a feature branch into master in CI environment. It seems to be the conventional-graduate option which makes it failed when you don’t have any prerelease packages yet. I removed it and it works now. I still try to figure out how can I make it work if I want to make prereleases in local environment and ensure all prereleases versioned packages are graduated to stable versions in the next merge. Lerna is still new for me so I would wait for more details from someone who knows it better than me.

5reactions
moughxyzcommented, Jun 16, 2022

You can do something like this if using GitHub workflows:

      - name: Bump Prod Version Graduate
        continue-on-error: true
        id: graduateRelease
        run: yarn lerna version --conventional-graduate --conventional-commits --yes

      - name: Bump Prod Version Fallback
        if: ${{ always() && steps.graduateRelease.outcome == 'failure'  }}
        run: |
          echo Falling back to non-graduate release due to https://github.com/lerna/lerna/issues/2532
          git stash
          yarn lerna version --conventional-commits --yes
Read more comments on GitHub >

github_iconTop Results From Across the Web

Git error "fatal: bad revision" when using git diff - Stack Overflow
In your case, you are using the String origin as the <commit> (or revision) you want to compare your working tree to.
Read more >
Solved: 'fatal: bad revision' when using git log with BITB...
The error message "bad revision" indicates that the local repository in your build doesn't contain one of the commits you're referencing. This happens...
Read more >
Developers - fatal: bad revision 'undefined' - - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
Job to check_links is broken ("fatal: bad revision") - GitLab
Problem to solve The check_links job is currently broken - it results in "fatal: bad revision".
Read more >
Error: "fatal: bad object..." during repo sync - Google Groups
Error: "fatal: bad object..." during repo sync ... For some unknown reason, you appear to have a bad revision in your git repo....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found