1

I have a load of commits, on a bitbucket branch where I was experimenting on the code. I want to squash all those into just one commit, without squashing all the other commits. Does this call for a rebase.

Bit confused on what a rebase is.

Tony
  • 363
  • 3
  • 17
  • see my answer please https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git/70306667#70306667 – rnewed_user Jan 10 '22 at 16:53
  • Hi thanks it sort of confused me. I did git rebase -i qa, qa being the Branch I want to squash commits on. But all I got was a v1 editor. Do I need to then write a script. Is thee a way to do it by the bitbucket console. – Tony Jan 10 '22 at 17:30

1 Answers1

1

yep you will get a console to edit the commits: like this:

git rebase -i qa then press keyboard 'i' to edit

you will see like this:

pick etc1
pick etc2
pick etc2

replace the word pick with 'f' and press esc y :wq

pick etc1 //this commit will the one commit
**f** etc2
**f** etc2

and press this command

git push origin +head
rnewed_user
  • 1,386
  • 7
  • 13
  • I dont get I got the following I just got a list of instructions noop # Rebase f20a064..f20a064 onto f20a064 (1 command) # – Tony Jan 10 '22 at 17:48
  • If I do this git reset --hard-10 , will this remove the last 10 commits on QA. That will work for me. – Tony Jan 10 '22 at 17:49