Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6793325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:05:14+00:00 2026-05-26T18:05:14+00:00

I did: git co upstream/master # To no branch. <then did a trivial edit

  • 0

I did:

git co upstream/master  # To no branch.
<then did a trivial edit on some file...>
git commit -a -m "Trivial edit"
git push origin NewBranch

But got this:

$ git push origin ignore-netbeans-config
error: src refspec ignore-netbeans-config does not match any.

Can I push to a new branch without creating a local one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:05:15+00:00Added an answer on May 26, 2026 at 6:05 pm

    Let’s clear up a few small details first:

    1. A branch is a “ref” under the refs/heads namespace. Just ls .git/refs/heads and cat the files there to see what I mean.
    2. A tag is “ref” under the refs/tags namespace. Just ls .git/refs/tags to see for yourself.
    3. HEAD just another “ref”, but it’s special in the aspect that it can be “symbolic”. Just cat .git/HEAD and see what it says.

    A push operation operates on a “ref”, and the default “mapping” preserves the namespace. This means that when I push a branch, it’ll appear as a branch on the remote; when I push a tag, it’ll appear as a tag on the remote. Consider the following scenarios:

    1. I want to push the tag moo and make it appear as a branch on the remote server (yes, I’m essentially “converting” a tag into a branch). This is how I’ll do it:

      git push origin moo:refs/heads/moo

    2. Git needs a way to differentiate between fast-forward and non-ff pushes, so that people don’t end up overwriting other people’s work by mistake. Let’s say I want to push the branches master, next, and pu, of which only pu is non-ff. This is how I’ll do it (note that you must supply an explicit mapping when you’re using +):

      git push origin master next +pu:pu

    3. Now, let’s get to your question. You want to push your HEAD so that it appears in the refs/heads namespace on the remote as a branch named “ignore-netbeans-config”. If this branch didn’t exist before, or if you’re overwriting some commits in it (ie. non-ff push), use the +. Otherwise, don’t. End result:

      git push origin +HEAD:refs/heads/ignore-netbeans-config

    TL;DR version: git push origin +HEAD:refs/heads/ignore-netbeans-config

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did git pull origin newbranch:newbranch ... but for some reason.. this tried merging
I just did git pull origin branch accidentally and now I have all these
I did : git add remote git@github.com:username/name_of_github_repo.git git push -u github master It returns
On branch 'first' I did: git add . git commit -m Finished first changes
To update my multiple repos, I did: git bulk fetch origin git bulk pull
I did an evil thing in github: used rebase, then push --force. This was
I did: git checkout sign-up And got this: M Gemfile Switched to branch 'sign-up'
I was working on a git branch other than master. I don't remember its
I forked rails and then this is what I did. > git clone git@github.com:nadal/rails.git
I did git submodule add git://github.com/msanders/snipmate.vim.git bundle/snipmate and then I deleted the directory. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.