git Tutorial
Introduction Installing Git Understanding Git architecture Initializing the new Git respository Cloning new Git repository .git directory in Git repository Viewing Git configuration First time Git configuration Using SSH keys with Git Checking Git status Adding files into staging area in Git Committing changes to the local repository Ignoring files using .gitignore Viewing the history of commits Viewing the file contents in working directory, staging area and repository Viewing difference between files Viewing the history of files Git revert Git Reset git reflog Creating and switching to new branches in Git Viewing existing branches Merging branches Resolving conflicts Rebase Deleting branches Renaming the branch in Git Push Pull Stashing the changes in Git Tags in Git Patches in Git Creating new repository on GitHub Pushing local repository to remote repository like GitHub IntelliJ IDEARevert commit in git
You can revert the last commit in Git using below command.
git revert <commit-id>
git revert 7893dd38bd467d
git revert HEAD
git revert HEAD^
Below example will help you understand how Git revert works. Notice that even though we revert second last commit – Q, other commits R and S are still in the git log history and additional commit T is also created reverting the changes made in commit Q. Below images show how we have reverted the commit starting with Hash id – 7893dd38bd467d. Notice that after reverting the commit, old commit remains in the git log. But new commit is created and all the changes in the old commit are reverted. Here is the output of above example.
Web development and Automation testing
solutions delivered!!