0

I deleted some of files in local repository and edited few of them. I do checkout eaworker-eps-hk2. After that when I do git status it shows :

 git status
On branch eaworker-eps-hk2
Your branch is ahead of 'origin/eaworker-eps-hk2' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Also when I do following steps:

git add -A
git commit -m "deleted and edited"
git push -u origin master

It give error :

git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://bitbucket-eng-sjc1.cisco.com/bitbucket/scm/ngise/dcs.git'

I tried without -u and using --force but they didn't worked either and gave same error.

  • 1
    Why are you pushing `eaworker-eps-hk2` to `origin/master`? Git is telling you that `eaworker-eps-hk2` is ahead of the remote branch `origin/eaworker-eps-hk2` not `origin/master`. – evolutionxbox Jul 12 '21 at 14:47
  • @evolutionxbox I am following second answer of https://stackoverflow.com/questions/9329244/how-to-commit-and-push-all-changes-including-deletes . When I pushed my local code first time to eaworker-eps-hk2(which were cloned from another branch), then it worked but it's not working now second time –  Jul 12 '21 at 14:50
  • 1
    What if you push without the extra options? `git push`? – evolutionxbox Jul 12 '21 at 14:56
  • wow @evolutionxbox thanks ! it worked . It removed all files I deleted and all edits are visible. Why my earlier approach was not working( I am new to git and I search and read and implement) ? Please write answer to educate beginners like me, I will accept it for your help –  Jul 12 '21 at 15:02
  • 1
    Probably there is no local `master` branch which made `git push -u origin master` fail – fortunately! Always be careful when copying and pasting commands from somewhere. Verify exactly what such commands are doing by looking at the manual/documentation. Then decide if this is really what you want to do. For example, I think you never wanted to force push *eaworker-eps-hk2* to *master*. – Matt Jul 12 '21 at 15:43
  • 1
    @Matt Okay, I will read documentation of command I am using from next time. –  Jul 13 '21 at 04:47

0 Answers0