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.

Support new branch creation by default

See original GitHub issue

Describe the bug I’m committing code to a new branch in a remote repo. The local repo has a new branch and the remote one does not yet have this branch.

Workflow used remote> git branch newbranch remote> git add . remote> git commit -am {commit message}

Expected behavior The line > Switching/creating branch... would create the branch.

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.

Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 8 changed files.
  { raw: '', remote: null, branches: [], tags: [] }
  > Switching/creating branch...
  Error: Error: error: pathspec 'aff' did not match any file(s) known to git

Pulling from remote… { raw: ‘’, remote: null, branches: [], tags: [] } Error: Error: There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.

  git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

  git branch --set-upstream-to=origin/<branch> aff

Outputs Error: Error: There is no tracking information for the current branch.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

drewwellscommented, Oct 25, 2021

workaround worked great, thanks. Since we’re going to be updating remote branches, I also need the --force flag. Here’s a full example for future people.

      - name: commit generated code
        if: github.repository == env.upstream
        uses: EndBug/add-and-commit@v7
          branch: ${{ github.head_ref }}
          # TBD: PRs may have an empty message
          message: ${{ github.event.head_commit.message }}
          add: .
          pull: NO-PULL
          push: --force --set-upstream origin  ${{ github.head_ref }}
allcontributors[bot]commented, Dec 3, 2021


I’ve put up a pull request to add @drewwells! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing the default branch - GitHub Docs
Under your repository name, click Settings. ... Under "Default branch", to the right of the default branch name, click . ... Use the...
Read more >
Basic Branching and Merging - Git SCM
To create a new branch and switch to it at the same time, you can run the git checkout command with the -b...
Read more >
Default branch - GitLab Docs
When you create a new project, GitLab creates a default branch in the repository. A default branch has special configuration options not shared...
Read more >
Project Configuration - Gerrit Code Review
The default branch of a remote repository is defined by its HEAD . The default branch is selected from the initial branches of...
Read more >
How can I create a Git repository with the default branch name ...
On October 1, 2020, if you haven't changed the default branch for new repositories for your user, organization, or enterprise, it will automatically...
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