# Git Revert Some Changes

### Tasks

1. Access the git repository at `/usr/src/kodekloudrepos/beta` on the `Storage server` in `Stratos DC`.
2. Identify the current HEAD commit to be reverted.
3. Revert the HEAD commit to the previous commit with the message "initial commit".
4. Use `git revert HEAD` to create a new commit with the message "revert beta".

#### Steps

{% stepper %}
{% step %}
SSH to the Storage server

```
ssh natasha@ststor01
```

{% endstep %}

{% step %}
Get root/sudo access

```
sudo su -
```

{% endstep %}

{% step %}
Navigate to the beta repo

```
cd /usr/src/kodekloudrepos/beta
```

{% endstep %}

{% step %}
Check recent commits

```
git log --oneline -2
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FrsLxx3yWNBDIi9OZRyTJ%2Fimage.png?alt=media&#x26;token=4a9af722-2d11-4792-8691-b9e3af772a39" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Revert the latest commit

```
git revert HEAD --no-edit
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2Fl1tRx6UN9eXdL2xEdq9Y%2Fimage.png?alt=media&#x26;token=8a41b468-2d80-4aef-965d-898a017e15f8" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Change the commit message to exactly "revert beta"

```
git commit --amend -m "revert beta"
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2Fn2MSektfF3Is7BRUJBCa%2Fimage.png?alt=media&#x26;token=bc9a7ada-9a4f-473b-857d-10cda97b79dd" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Verify the commit history

```
git log --oneline -2
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FpFxuc1r3fkkTTnSdKDAq%2Fimage.png?alt=media&#x26;token=37aeda68-176e-4605-8b7f-2bd93e1c7dad" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
