Answer the question
In order to leave comments, you need to log in
In git I committed to master - how to fix it?
Out of inexperience, I started committing and pushing to master. And the comrade with whom we are picking this business together, also inexperienced, accepted my changes.
I want to drag all my changes into the "experiment" branch.
I googled, tried all the options that I found - something turns out not right. New branches appear, but the data remains in the old branch ... or I don’t understand anything at all.
Who would explain to me what to do with it. No matter how I dance around all this, I don’t get what I want.
And I read all sorts of manuals, and learned some tutorials ... The brain boils.
Here is my art on github: link
This is git hist -all
* a2e5084 2020-04-17 | graf.okno.ui (HEAD -> master, origin/master, origin/HEAD) [Abay101]
* 480c1f7 2020-04-14 | Merge pull request #4 from phaggi/master [Abay101]
|\
| * 9baf9f7 2020-04-12 | add requirements.txt (tag: v4) [phaggi]
| * 9152825 2020-04-12 | add requirements.txt [phaggi]
* | a017344 2020-04-08 | Merge pull request #3 from phaggi/master (tag: v3m) [Abay101]
|\ \
| |/
| * 32690b0 2020-04-08 | add SQLite db with questions and it's senses add sqlite test for db (temporary) (tag: v3) [phaggi]
|/
* 06ef79e 2020-04-07 | Merge pull request #2 from phaggi/master (tag: v2m) [Abay101]
|\
| * fe6020c 2020-04-07 | make .trash, move and remove old files (tag: v2) [phaggi]
| * a0c70b3 2020-04-07 | add template YAML with keys [phaggi]
| * 93f5326 2020-04-07 | remove keys, add function 'makekeys' [phaggi]
|/
* 3624ce5 2020-04-05 | Create listen.py (tag: v1) [Abay101]
* c64ef5e 2020-04-05 | Create speak.py [Abay101]
* 3d335c2 2020-04-05 | Create translate.py [Abay101]
* 29aa591 2020-04-04 | Add files via upload [Abay101]
* 0162e7d 2020-04-04 | Danelia [Abay101]
Answer the question
In order to leave comments, you need to log in
# переименуем master в experiment
git checkout master
git branch -m experiment
# удалим удаленный master
git push --delete origin master
# зальем текущую ветку на удаленный репо:
git push -u origin experiment
# переключимся на комит с которого пойдет мастер по его хэшу:
git checkout 3624ce5
# ответвимся от сюда в новую ветку с именем master
git checkout -b master
# и залем ее на удаленный репо
git push -u origin master
And git push origin :master
it is necessary with a colon?
with a colon gives an error:
To https://github.com/phaggi/Abay.git
! [remote rejected] master (refusing to delete the current branch: refs/heads/master)
error: failed to push some refs to 'https://github.com/phaggi/Abay.git'
error: src refspec master does not match any.
git checkout -b master
throws an errorfatal: A branch named 'master' already exists.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question