I have a project directory(without git folder) where I am working and trying to update an existing remote branch forcefully.
Steps I have taken -
1. git init
2. git add .
3. git commit "Fresh update after changing db"
4. git remote add origin <repo_url>
5. git push origin staging
And I get the below error -
error: src refspec staging does not match any.
error: failed to push some refs to '<repo_url>'
When I do git branch -a
it doesn't show all the branches just only master
.
Any help is highly appreciated.
Take pull after adding remote:
1. git init
2. git add .
3. git commit "Fresh update after changing db"
4. git remote add origin <repo_url>
5. git checkout -b staging
6. git fetch
7. git push -f origin staging
Avoid using force push if possible. Let me know exact scenario for better solution.