Hands-on task
Undo a bad commit with revert
The project repo lives in GitLab and is cloned to /root/repo (the web sign-in is on the GitLab tab). main has three commits: init, then add bug (it added an unwanted file bug.txt) and add feature (it added feature.txt), and all of them are already in GitLab.
Undo the effect of exactly the add bug commit without rewriting history: bug.txt must disappear, feature.txt must stay, and a new undo commit must appear in the history (4 commits in total). Push the result to GitLab.
The main branch in GitLab is protected: the server will reject push --force, so reset won't help here.
- git revert
- undoing a commit
- commit history
- git log
- git push
- GitLab