Let's clear up a few small details first:
- 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.
- A tag is "ref" under the
refs/tags
namespace. Just ls .git/refs/tags
to see for yourself.
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:
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
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
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