0

[git newbie here]

I have the following commits:

[c1]-->[c2]-->[c3]-->[c4]-->[c5]

HEAD is now at c5 but I realized that c4 and c5 are not good and I wish to continue from c3. In other words, I wish to revert to c3 mark it as HEAD and continue from this point on (make changes form this point). How can I do that?

when I get the commit of c3

$git checkout c3

improve some files and:

git add .
git commit -m 'lets continue from c3'
git push

it says:

fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

    git push origin HEAD:<name-of-remote-branch>
pylos
  • 102
  • 8

1 Answers1

0

try to use :

git rebase -i HEAD~2

then you get a file open with 2 msg " pick idCommit commit msg" => delete the 2 msg of the unused commit

Chady BAGHDADI
  • 203
  • 2
  • 7