Here I changed the project and made git add . first git add . , then all the git commit -m "..." zakomitel and then push the repository to the master branch. And now I need to push some files to another branch. But how to do that?

  • 3
    You can not "push files to another branch." But no one bothers to copy these files, switch to the correct branch, then copy the files back to the repository and commit-push - KoVadim
  • @KoVadim and I just recently got acquainted with git and I still don’t understand what it means to "switch to the right branch." Here I have a project, let's call it project which is a master branch. What do I need to do to switch to the development branch? - Ivan Petrov
  • 3
    Вот у меня есть проект, назовем его project который является мастер веткой. uh ... in which there is a branch named master. Switch to the development branch - git checkout development . These are basic things. - KoVadim pm
  • @KoVadim, once I sat down and read a book on git but it never came to practice. The second time it came to practice and again I read the book, but it immediately turned out that there was a greater need in another field and again I forgot what I was reading. Now I am not eager to sit down and read again. I ask around for a day or two, go into what is happening and then read it. 1) So, I switched to another branch and added the files I needed, zakomitil them and push. So you need to work? - Ivan Petrov
  • one
    Так нужно работать? - but I do not know what you need. But if it does as it should, then it must be done that way. but the second point ... I don’t even quite understand what I want to do. - KoVadim 2:49 pm

1 answer 1

After your push to the wizard, switch to the correct git checkout branch_name (or git checkout -b branch_name if the branch has not been created yet), commit the necessary git commit file.jpg (for each file) and push the required these git push origin branch_name files git push origin branch_name per branch

  • does not work. To https://github.com/**/**.git ! [rejected] gh-pages -> gh-pages (fetch first) error: failed to push some refs to 'https://github.com/**/**.git' подсказка: Updates were rejected because the remote contains work that you do подсказка: not have locally. This is usually caused by another repository pushing подсказка: to the same ref. You may want to first integrate the remote changes подсказка: (eg, 'git pull ...') before pushing again. подсказка: See the 'Note about fast-forwards' in 'git push --help' for details. - Ivan Petrov
  • Well, it is written in English and white, that these changes, which are pushed, are not locally. you need to push them yourself, and then push the merged files where necessary - lexxl