D
D
Denis Bukreev2017-04-12 14:33:02
git
Denis Bukreev, 2017-04-12 14:33:02

How to set the current commit as the main one and truncate all subsequent ones?

So it goes.
I rummaged through the documentation for the git, well, nothing is clear, but I don’t want to break the project completely.
The situation is this: I made a pull on the project server, there was a conflict (also some kind of permanent nonsense with this git), well, let me smergil, did a push, locally did a pull, corrected the conflict, did a push, made a pull on the project server and everything came to a head (500 error) and the server does not bring anything back to life, except for rolling back to the commit before my edits (git checkout hash)
And here is my plan: make the current commit on the server the main one, push it to the repository, locally accept and work further ( small edits - work out quickly).
But how do you set the current commit as the main one so that all later ones are removed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sundukov, 2017-04-12
@denisbookreev

Do a hard reset. I copy directly from the command history as is:

git reset --hard f41fb592c8fd92c19f77efd96f341298e4175a7b
git commit -m 'Revert to f41fb592c'
git push origin -f

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question