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.

Stash is not popped when using `--rebase --autostash`

See original GitHub issue

Describe the bug We noticed that the action fails to commit if external changes were introduced to the repo between checking out the repo and running the commit action. The worst thing is that the step doesn’t fail and it seems like everything works fine.

I am able to consistently reproduce this on Windows (on windows-latest runners) and Mac (on macos-latest runners)

Workflow used

name: Tests


    runs-on: windows-latest
      - name: Initialize workflow parameters
        id: git-branch-name
        uses: EthanSK/git-branch-name-action@v1

      - name: repository check out
        timeout-minutes: 10
        uses: actions/checkout@v3
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Write to file and sleep
        run: |
          echo "hello" >> test.txt
          Start-Sleep -Seconds 60

      - name: Commit and push to repo
        uses: EndBug/add-and-commit@v9
          pull: --rebase --autostash
          message: "testing"
          tag: "new_try_${{ github.run_id }}"
          add: "['test.txt']"
          author_name: tester

Expected behavior I wrote this workflow just to reproduce the bug. If you manually push to the repo while this workflow is sleeping, you’d expect it to pull the external changes, rebase over them and then commit the new change. That doesn’t happen.

What actually happens is the action fails to commit, but the step ends up with success status

Logs Either provide a link to the action run or (if your repo is private) paste here the logs from the step that uses it. If you paste the logs, please use this template, and remember to paste the logs from all the different sections.

Pulling from remote...
  ##[debug]Current git pull arguments: --rebase --autostash
  ##[debug]Git args parsed:
  ##[debug]  - Original: --rebase --autostash
  ##[debug]  - Parsed: ["--rebase","--autostash"]
  { raw: '', remote: null, branches: [], tags: [] }
  PullSummary {
    remoteMessages: RemoteMessageSummary { all: [] },
    created: [ 'another_test.txt' ],
    deleted: [],
    files: [ 'another_test.txt' ],
    deletions: {},
    insertions: { 'another_test.txt': 1 },
    summary: { changes: 1, deletions: 0, insertions: 1 }
  > Creating commit...
  ##[debug]Git args parsed:
  ##[debug]  - Original: 
  ##[debug]  - Parsed: []
    author: null,
    branch: '',
    commit: '',
    summary: { changes: 0, insertions: 0, deletions: 0 }
  ##[debug]Setting output: committed=true

::set-output name=committed::true ##[debug]=‘true’ ##[debug]Setting output: commit_sha=

::set-output name=commit_sha:: ##[debug]=‘’ Warning: Couldn’t parse long SHA: Error: fatal: ambiguous argument ‘’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’

> Tagging commit…

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

EndBugcommented, Jun 24, 2022

You’re right, I’m able to reproduce the issue: the stash is not popped back even when there are no conflicts. I’ll investigate further.

EndBugcommented, Jun 13, 2022

you’d expect it to pull the external changes, rebase over them and then commit the new change.

Yeah, that’s what I would expect if you were using git pull --rebase, but you’re using git pull --rebase --autostash: that means that your local uncommitted changes (test.txt) will be stashed before the rebase.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shouldn't "git pull --rebase --autostash" always pop the stash ...
The behavior (er, behaviour) you see is normal, because the operation is still in progress. The autostash should be popped—or rather, ...
Read more >
Git: How to automatically stash while rebasing or merging
Unstash your current changes with git stash pop . Since this is a useful sequence, Git has “autostash” options that make rebase and...
Read more >
Git tip: autostash with git pull --rebase - Chi Shang Cheng
If there are uncommitted changes, you need to stash those changes first, then pull the remote updates, and pop your stash to continue...
Read more >
Re: A bug or issue with "git rebase --autostash" not popping the ...
Autostash creates a stash. Remote changes are applied with the rebase. > 6) PROBLEM: the stash is not automatically popped. > > "git...
Read more >
Git autostash - Eficode
Investigating the new git autostash feature and how to use it to allow pulling new changes into a dirty workspace.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found