A
A
Alan Gibizov2020-04-18 20:54:17
git
Alan Gibizov, 2020-04-18 20:54:17

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

spoiler
* 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

2 answer(s)
D
Dmitry Belyaev, 2020-04-18
@phaggi

# переименуем 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

A
Alan Gibizov, 2020-04-18
@phaggi

And git push origin :masterit 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'

However, both with and without produces an error.
without - gives an error:
error: src refspec master does not match any.
It seems that I understood where the rake is. I guess.
I took down the fork on github and made it again from the original repository, then cloned it to myself.
Maybe you need to make some kind of commit there?
ps made a commit, push without colon passed.
Now git checkout -b masterthrows an errorfatal: A branch named 'master' already exists.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question