How to Revert a Git Commit

preview_player
Показать описание
Sometimes when you think you need to revert a Git commit, what you really need is a reset. In this Git revert a commit example, I'll show you how the Git revert command works, and contrast it with the Git reset command.
Рекомендации по теме
Комментарии
Автор

thank you very much. short but clear. i love it.

ragilburhanudinpamungkas
Автор

Such a great explanation. But this one thing is not clear for me:

Let's say you have this:
First commit: 1 File added, 1 insertion ("hello world")
Second commit: 0 Files added, 1 insertion ("second line")
Third commit: 0 Files added, 1 insertion ("third line already wow")

if you revert the second commit will the changes affect the third commit? What will the file say: ("hello world") or ("hello world third line already wow") ?

Mkrabs
Автор

As part of a solution where I was unable to push to a remote repository, I was told to pull but first run a stash.

After the git stash was completed a message was displayed about one of the commits being skipped. On executing a stash deploy. I found that the file of that commit was now the out of date previous version. Can you please give me some idea why?

geriatricprogrammer
Автор

I was looking for a confirmation of what I was observing and this was exactly it. It doesn't behave as expected which is why its so confusing. It is advertised as the "safe" way but it is not! It deletes what you think you are reverting to. Revert means revert life like this commit never existed. Thanks.

theangrycoder
Автор

I wish someone would do one of these for people who aren't programmers. I got lost in the intro. Everybody assumes viewers already know how to do 99% of what they're showing.

HikingWithCooper
Автор

Hi, how to do git revert, if we have already push the code to remote branch ? because in your example you didn't push anything.

ajaydhiman
Автор

Nice demo. But you should also have executed the git reflog command after the git revert command

paradeen
Автор

can you help me get a job in java or java spring?

AozenDreyar
Автор

Very good example. Just one improvement though, next time create a file like 1.txt 2.txt 3.txt for each commit, then it'll be easier to demonstrate your point.

tomnguyen