- Run
source setup.sh(or.\setup.ps1in 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 --onelineto look at the history - Use
catto view the content ofgreeting.txt - Use
git reverton the newest commit, to remove the changes the last commit added - Use
git log --onelineto view the history - Did the revert command add or remove a commit?
- Use
catto view the content ofgreeting.txt - Use
lsto see the content of the workspace - Use
git log --onelineto find the sha of the commit adding credentials to the repository - Use
git revertto revert the commit that added the credentials - Use
git log --onelineto view the history - Use
lsto see the content of the workspace - How many commits were added or changed by the last revert?
- Use
git showwith 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 --onelinegit show <ref>