- Run
source setup.sh
(or.\setup.ps1
in PowerShell)
In this task a few changes snuck in, that we'd like to get out. Our history is public, so we can't just change it. Rather we need to use revert to remove the unwanted changes in a safe way.
- Use
git log --oneline
to look at the history - Use
cat
to view the content ofgreeting.txt
- Use
git revert
on the newest commit, to remove the changes the last commit added - Use
git log --oneline
to view the history - Did the revert command add or remove a commit?
- Use
cat
to view the content ofgreeting.txt
- Use
ls
to see the content of the workspace - Use
git log --oneline
to find the sha of the commit adding credentials to the repository - Use
git revert
to revert the commit that added the credentials - Use
git log --oneline
to view the history - Use
ls
to see the content of the workspace - How many commits were added or changed by the last revert?
- Use
git show
with the sha of the commit you reverted to see that the credentials file is stilll in the history - As you have now reverted the credentials file, so it is removed from your working directory, is it also removed from git?
git revert <ref>
git log --oneline
git show <ref>