I'm on a branch called A
..
the branch A
has two commits, with the following codes: commit1
and commit2
where the most recent is commit2
.
i just noticed i want to go back to commit1
because in commit2
I deleted a file I needed and i wrote some useless code.. i want to go back to commit1
so i do git checkout commit1
on the terminal it now says i'm here: $ git:(commit1)
but what I expected was $ git:(A)
i'm not sure how to make commit1
my base for the the branch.
is it git revert
? git reset
? I've read the docs but I'm not quite sure what to do
If you want to remove your commit2 permanently then do git reset --hard <commit1-id>
This will take to commit1 in branch A.