Git Push Problems

I have a repository that I recently cloned from github. Address git://github.com/JoshClose/CsvHelper.git

if you want to try this. I am using tortoisegit but will use the command line to fix this if needed (I might need my hand for this).

The log looks like this:

*   0.11
|
| * master origin/HEAD origin/master 0.10
| |
|-
|
*   0.9.1

      

I'm pretty sure that after making the changes for 0.10 I didn't switch branch to 0.9.1 and was working from 0.11, but it looked like it.

What I want to do is remove 0.11, go to 0.10, make the changes for 0.11 that I need, then push to github. The changes are small, but I could combine the two, I suppose.

After the changes, the log looks like this:

* (this has no label/branch name)
|
* master origin/HEAD origin/master 0.10
|
* 0.9

      

Why didn't the master switch to my new changes?

When I do this and try to push to github, or make any changes and push, I get the error:

git.exe push    "origin" (no branch)

error: src refspec (no does not match any.
error: src refspec branch) does not match any.
error: failed to push some refs to 'git@github.com:JoshClose/CsvHelper.git'

      

I tried to pull them out using the push method to fix this problem, but it didn't work. Pulling says everyone knows. I tried doing --force too, but I get the same error.

I think the problem is because the master is not set with new changes. When I go to push to github, the branch I'm on says (no branch).

What can I do to fix this? I'm ready to just delete the repository and start over.

+2


a source to share


1 answer


You have to check directly the tag or SHA1 commit, causing the HEAD to be disabled . All your updates / modifications happened on this unnamed branch link using the "detached HEAD" mentioned.

Before pushing, you must create (declare) a branch or merge master with a HEAD merge (fast forward).

git branch tmp
git checkout master 
git merge tmp # fast-forward master

      



This should give you:

* (master,tmp)
|
* origin/HEAD (origin/master) 0.10
|
* 0.9

      

+3


a source







All Articles