How to join specific commits using git rebase -i?

Asked

Viewed 276 times

0

How do you join commits Clearing index using the git rebase -i skipping the commit Removing . env? I know that the squash joins commits, but like skipping a specific commit?

I have the following scenario: git log

commit 55ace82f06eb19553fe6e99c5154cc1e4bcedb67 (HEAD -> master)
    Limpando index

commit 68a4eedc5ee5e842a15abde159b1c339ae25bc82
    Removendo .env

commit 937d30c71dab2e82ec2a265558cc2f72ccc85333
    Limpando Index

Commando: git rebase -i HEAD~3

pick 937d30c Limpando Index
pick 68a4eed Removendo .env
squash 55ace82 Limpando index

How do I skip the commit 68a4eed without erasing?

1 answer

1


You can reorder your commits and then squash.

$ git rebase -i HEAD~3

pick 68a4eed Removendo .env
pick 937d30c Limpando Index
squash 55ace82 Limpando index
  • Bro, it worked, but the pick should be in the second commit if it doesn’t bring all three together. And my intention is to join the "Clearing Index" and skip the "Removing . env". Edit the response for the staff understand.

  • 1

    Quiet, I was wrong to edit.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.