Git rest & revert deep dive | Git revert vs reset Demo | Git tutorial | Java Home Cloud

preview_player
Показать описание

Git revert and git reset are two Git commands used to undo changes in a Git repository, but they work differently.

Git revert is a command that creates a new commit that undoes the changes made by a previous commit. It is a safe way to undo changes in Git, as it does not modify the commit history. Instead, it adds a new commit that contains the opposite changes to the ones in the commit you want to undo. This means that the commit history is preserved and that you can revert the revert later if you need to.

Git reset, on the other hand, is a command that modifies the commit history by moving the branch pointer to a previous commit. It allows you to discard changes made after a specific commit and to reset the repository to that commit's state. This means any commits made after the reset commit will be removed from the repository's commit history.

✨ *Popular Playlist* ✨

🏛️ *Courses Offer By Java Home Cloud* 🏛️

📹 *Udemy Courses* 📹

Рекомендации по теме
Комментарии
Автор

Hello Sir, the best explanation I have seen so far about git revert and git reset. Thanks and keep up the good work 👍

mrasoft
Автор

You can use git reset and do a force push.

manjunadh
Автор

Man, you can push the removal of a commit using —force. That local vs remote idea is just wrong. You want git revert because you want to keep track of the reverted changes. Not pushing resets is just a best practice, it’s not impossible.

dariorodriguez
Автор

SIr, can we able to revert it to a specific commit we want using revert command?

In our case, we are just reverting the most recent commit that we made.

anandhakumarg
Автор

There is no git rest command, plz correct it

dhirajprasad