0

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

valerio0999
  • 11,458
  • 7
  • 28
  • 56
  • What exactly do you want? Discard commit2 permanently? Apparently according to your comment below. Do you want to insert some changes between commit1 and commit2? – Matthieu Moy Apr 05 '16 at 09:34

1 Answers1

0

If you want to remove your commit2 permanently then do git reset --hard <commit1-id>

This will take to commit1 in branch A.

Devanshu Dwivedi
  • 693
  • 2
  • 6
  • 18