27/100 Git Revert some changes
The Nautilus application development team was working on a git repository /usr/src/kodekloudrepos/games
present on Storage server
in Stratos DC
. However, they reported an issue with the recent commits being pushed to this repo. They have asked the DevOps team to revert repo HEAD to last commit. Below are more details about the task:
- In
/usr/src/kodekloudrepos/games
git repository, revert the latest commit( HEAD )
to the previous commit (JFYI the previous commit hash should be withinitial commit
message ). - Use
revert games
message (please use all small letters for commit message) for the new revert commit.
ssh natasha@ststor01
sudo su -
cd /usr/src/kodekloudrepos/games
git log
commit 60e65813b5ddf86c1e4db45cab6e7609c4995c10 (HEAD -> master, origin/master)
Author: Admin <admin@kodekloud.com>
Date: Thu Sep 18 09:53:37 2025 +0000
add data.txt file
commit cc89cb9ad6562337a34a65b09044c7cf4b2d6365
Author: Admin <admin@kodekloud.com>
Date: Thu Sep 18 09:53:37 2025 +0000
#revert back to HEAD
git revert HEAD
# This pops up vi - use esc :x enter - make no changes
[master 14c3d38] Revert "add data.txt file"
1 file changed, 1 insertion(+)
create mode 100644 info.txt
git add games.txt
git commit -m "revert games"
[master aa72f63] revert games
1 file changed, 1 insertion(+)
create mode 100644 games.txt