A bad commit is undone with a new commit. The history stays the way everyone has already seen it.
Your own edit is recorded as a commit too. git add <file> marks the file for recording, git commit -m "message" records a snapshot under your name — in this repository it is already set: student.
git revert <hash> reads the changes of a commit and records a new commit that undoes them. Later commits, even in the same file, stay untouched. The --no-edit option takes the ready-made message Revert "…" — without it git opens an editor for the message.
History can also be rewritten: git reset --hard <hash> moves the branch back and throws away every commit after that hash, other people's edits included. The config history is a log for every admin, so on a shared config a commit is undone with revert. The ways to roll back side by side — in the Wiki.
The history has four commits. You undo the second from the top with git revert. What will git log --oneline show afterwards?
-
That is what
git reset --hard <hash>would do to the branch.revertleaves later commits alone — both them and their edits. -
revertdeletes nothing: it adds a commit with the reverse changes. Commits disappear withgit reset --hard. -
A recorded commit never changes in git: its hash depends on its content.
revertwrites a new commit on top, the old one stays as it was.
git revert records a new commit with the reverse changes and removes nothing from history. The undone commit and everything after it stay in git log, with “Revert …” on top.
A commit from the middle of the history can be undone too: git applies the reverse edit on top of everything that came after it, as long as those commits did not touch the same lines.
The 2m limit turned out to be a mistake: Anna lowered it for a test and forgot to put it back. After her, Oleg added /health to the same file — monitoring polls that check. A commit changes only the files: the running nginx rereads them after sudo nginx -t and sudo systemctl reload nginx.
Undo the limit commit
In /etc/nginx undo the commit that lowered the upload limit in conf.d/lab-site.conf so that the history stays as it was and the /health check from a later commit stays in place. Apply the config: a 5 MB upload to http://127.0.0.1:8080/upload must go through.
Goals · 0 of 2
- Undo the limit commit without rewriting history not done yet
- Apply the config in the running nginx, keeping /health not done yet