0

I can do this using VS2019 without issue, but I'm trying the GIT command line usage and I get the above error in the title.

I have committed that file (crossed out in gray line) but I want that file to show in the remote branch the yellow arrow is pointing to in the image.

When I issue git log, I can see it is there.

I'm assuming "origin" is where the file has been committed, so I tried issuing:

"git push -u origin feature" - doesn't work; "git push origin remotes/origin/feature" - doesn't work;

but I get error as well Our repository structure is like this:

enter image description here

enter image description here

Laila Villa
  • 85
  • 1
  • 8
  • Can you show the error here? – LF00 Jun 30 '21 at 00:52
  • I don't recognize this particular GUI, but it looks like you don't have any branches named `feature`. You do have one branch named `feature/something-you-obscured`, perhaps. – torek Jun 30 '21 at 01:07
  • that GUI is from visual studio 2019. when you click on the lower right area where the path location is, it's going to display that window. Our practice is to checkout our code from DEVELOP, then create a task/bug under FEATURE folder, then push that to remotes/origin/feature folder, then create a pull request from there. The beginning of that yellow line is the task that's already been there (committed earlier), I just want to push that to remote (to location where that arrow is pointing) using GIT command. – Laila Villa Jun 30 '21 at 01:09
  • 1
    Does this answer your question? [Message 'src refspec master does not match any' when pushing commits in Git](https://stackoverflow.com/questions/4181861/message-src-refspec-master-does-not-match-any-when-pushing-commits-in-git) – matt Jun 30 '21 at 02:03
  • 2
    The branch is not called feature. It's called `feature/blahblah`. Basically you have hidden the info we need to help you. Fine, but then you are on your own. – matt Jun 30 '21 at 02:04
  • @matt, that branch is hidden because I'm working on a company with super strict policies when in comes to security and information disclosure, I could call the branch MissPiggy, but does that matter so much over the command that I need to issue? In VS2019 UI, when you push the staged changes, it automatically pushes those changes to remote with the same branch name, or create one when it doesn't find it. – Laila Villa Jun 30 '21 at 03:43
  • 3
    Then you would say `git push origin feature/MissPiggy`. The point is to get the name right. – matt Jun 30 '21 at 03:58
  • Thanks @matt, I used git push origin [shavalue_here]:refs/head/feature/MissPiggy and it worked. cheers – Laila Villa Jul 07 '21 at 00:55

1 Answers1

1

You can see the name of your local branches with:

git branch

This differs from the remote tracking branches, generally starting with origin/...

If you see a local branch named feature/xxx, then you would do

git push -u origin feature/xxx
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250