0

Having trouble pushing my commit to github.

Was having super weird node.js behavior and found the solution was to revert back a commit and then manually overwrite my project with Github's zip download.

That worked for solving my weird node.js behavior but now I can't get GitHub to take the current commit as it's not the head?

My tries:

$ git push origin test-branch
error: src refspec test-branch does not match any.
error: failed to push some refs to 'https://github.com/name/project.git'

$ git push --force origin master:master
Everything up-to-date

$ git push origin HEAD:refs/heads/master
To https://github.com/name/project.git
! [rejected]        HEAD -> master (non-fast-forward)

Any way to save me?

1 Answer 1

2

Your test-branch is not on remote, you need to use -u option :

git push -u origin test-branch

ref How do you create a remote Git branch?

6
  • what about : git push origin HEAD:refs/heads/test-branch Commented Feb 11, 2017 at 23:57
  • added the response to the question Commented Feb 11, 2017 at 23:59
  • why you push to master ? push on your branch(test-branch), then use the Pull Request to merge two branches. Commented Feb 12, 2017 at 0:03
  • How do I suggest I merge the branches now? Commented Feb 12, 2017 at 0:05
  • Are you using Github ? go to the project and use "New Pull request" button. base : master, compare : test-branch Commented Feb 12, 2017 at 0:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.