D
D
Dmitry2019-06-23 00:04:12
git
Dmitry, 2019-06-23 00:04:12

How to remove the last commit?

Hello. There is a project which I do by two machines. One is a work computer, the second is at home. At the moment, all the changes were on one of the machines. On the second one, I did a git pull, that is, I took the changes made from the other one. The question actually is that where I did git pull, the current working version is currently located, but when the git status command is executed, it displays a message

On branch master
Your branch is ahead of 'origin/master' by 13 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean

In fact, I need to cancel or rather delete everything that is in the commit (only on this machine locally), but without changing or deleting all physically present files. In fact, it is necessary that everything remains as it is, but the above message was not displayed.
How to do it?
So it is possible?
git reset HEAD~1 --soft
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1001001, 2019-06-23
@1001001

git reset --soft HEAD^1will remove the top commit leaving the changes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question