I'm trying to push code to my branch and I haven't made any commits to the branch previously. git add and git commit work fine but when I do git push, I get the following error:
fatal: The current branch my_branch has no upstream branch. To push the current branch and set the remote as upstream, use
git push --set-upstream origin my_branch
When I run the suggested command, I get another error:
fatal: my_branch cannot be resolved to branch
I tried git pull too and that works fine but when I do git pull specifically for my branch like, I get another error:
git pull origin my_branch
fatal: couldn't find remote ref my_branch
Thanks in advance:)
Thanks to everyone who helped but I was able to fix the issue by doing this:
//git indicated that my branch and master branch have diverged so I did step 4
I found this link helpful: https://intellipaat.com/community/21465/git-status-on-branch-master-nothing-to-commit-working-tree-clean-however-with-changes-commited
Also, creating a new branch may not be necessary, as long as other steps are the same.