V
V
Vladislav Dudashvili2021-03-18 20:36:12
git
Vladislav Dudashvili, 2021-03-18 20:36:12

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.


How do I add files to the backend branch in my repository?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-03-18
@bacon

init is to create a completely new repository, so it’s right to clone it instead, then create the required branch, make edits in it and push it already

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question