A
A
Automat2017-10-10 15:49:34
git
Automat, 2017-10-10 15:49:34

How to remove a commit from a push?

Pictures from the Internet, but the situation is essentially the same:
7-pHJQmbj8o.jpg
The bottom line is that the first commit "Done well" was made in the master by my colleague, while the git status command shows the files changed in my local copy only by 4 other commits, i.e. he does not see the change of his colleague. But if I push now, there will be a conflict between my old version of master and the new version of the file in the first commit from a colleague.
Options:
1) Make a push, resolve the conflict manually
2) Download the latest version of the file that was changed by a colleague from the master, this file will be reflected in me as modified, push everything together
3) Delete this commit somehow and offer a pull request after pushing without him. After that, already download the updated master

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Katkov, 2017-10-10
@nomotrack

Never develop in the master branch! Always make a separate branch git checkout -b new_branch_baby
To get out of this embarrassing situation now, you need to:
- Copy all changes to a separate branch ( git checkout -b my_changes)
- Purge the master of your changes ( git checkout master ; git rebase -i HEAD~6)
- update the master branch ( git pull origin master)
- update your branch ( git checkout my_changes ; git rebase master)
good luck

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question