0

Im new using GIT...While working with it, i have created intermediate commits just in the case my computer crash or something like that, so i have a commit history like this in a new branch

frmClients - crud Operations final
frmClients - crud Operations tmp3
frmClients - crud Operations tmp2
frmClients - crud Operations tmp1

I would like to know if there is a way to delete those intermediate commits (from tmp1 to tmp3) and keep only the last one, i didnt merge&push it yet to the server.

Doing a revert or hard reset wont do what i want. Or mayb im using git in a wrong way?

lbtg
  • 81
  • 1
  • 1
  • 4
  • 2
    Possible duplicate of [Squash my last X commits together using Git](http://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git) – Scott Weldon Sep 12 '16 at 20:23

1 Answers1

1

Rebase is your friend here:

git rebase -i HEAD~4

Replace the second to fourth lines starting with "pick" to "f" for "fixup", and you'll end up with a single commit.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Yeah mayb my question is duplicated, but ur answer helped me a lot to go for the right way and save time, since im new on git and i was lost on how to do this. thanks – lbtg Sep 13 '16 at 22:57