Answer the question
In order to leave comments, you need to log in
How to add files to a new branch of an already created repository?
I need to add files to a branch I created, not master. I don't understand how to do it. Here's what I do:
git init
git add .
git commit -m "adding files"
git remote add origin https://github.com/s1veme/hotelOrder.git
git push -u origin
backend
! [rejected] backend -> backend (fetch first)
error: failed to push some refs to 'https://github.com/s1veme/hotelOrder.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question