<p>Simplest answer is to just revert the commit.  AWS Code Commit is standard Git and will support everything Git allows you to do.</p>
<p>I.e. find commit hash:</p>
<pre><code>git log -n1
commit 444c954e458cc446e2a7a1f2659adf71bdf55580 (HEAD -&gt; my-branch, origin/my-branch)
</code></pre>
<p>Then do the revert:</p>
<pre><code>git revert 444c954e458cc446e2a7a1f2659adf71bdf55580
git push
</code></pre>
<p>It'll revert your repo to whatever state it would be without that specific commit.  Note that if you have other commits that modified the same files afterward, you will have a merge conflict and will have to fix them manually.</p>

CC BY-SA 4.0
2021-01-28T15:06:48.503Z
2021-01-28T15:06:48.503Z
maplebird
<p>I know of git rebase but don't know if it can be used with AWS code commit?
Or if there's any other method of removing a commit to revert back to before it was made and merged?</p>

<amazon-web-services><git><versioning>
Can you remove a commit made to a branch on AWS code commit?
doug
# Can you remove a commit made to a branch on AWS code commit?

(Asked by: username_0 on 2021-01-27)

I know of git rebase but don't know if it can be used with AWS code commit?
Or if there's any other method of removing a commit to revert back to before it was made and merged?

**Tags:** amazon-web-services, git, versioning


---

## 1 answers

### Answer by username_1 on 2021-01-28. Score: 2

Simplest answer is to just revert the commit.  AWS Code Commit is standard Git and will support everything Git allows you to do.
I.e. find commit hash:
git log -n1
commit 444c954e458cc446e2a7a1f2659adf71bdf55580 (HEAD -> my-branch, origin/my-branch)

Then do the revert:
git revert 444c954e458cc446e2a7a1f2659adf71bdf55580
git push

It'll revert your repo to whatever state it would be without that specific commit.  Note that if you have other commits that modified the same files afterward, you will have a merge conflict and will have to fix them manually.


---

