Revert

Reverting, in terms of Git, means rolling back the changes from one or more commits. This is one of the reasons why your commits should not contain changes to loads of files. Reverting such a change will disrupt more than it fixes. With reverting, a new commit is created that reverts all changes performed in that specific commit:

# Changes to a file that need to be rolled back
Add-Content -Path .NewScript.ps1 -Value 'Get-Process -Id $pid'
git add .
git commit -m 'Added get-process to script'

Add-Content -Path .NewScript.ps1 -Value 'Restart-Computer -Force'
git add .
git commit -m 'Added restart-computer to script'

# Revert first change as a new commit
git log

# Revert all changes within this commit
git revert 02fdabc

# Verify that your change is gone
Get-Content .NewScript.ps1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset