1

I want to combine several commit into one commit.

git checkout origin/develop -b develop
echo "a" >> README && git commit -am "Feature A commit 1"
echo "a" >> README && git commit -am "Feature B commit 1"
echo "a" >> README && git commit -am "Feature A commit 2"
echo "a" >> README && git commit -am "Feature B commit 2"
echo "a" >> README && git commit -am "Feature A commit 3"
echo "a" >> README && git commit -am "Feature B commit 3"

Before I push, I want to combine Feature A commit 1,2,3 into one commit Feature A commit, and same as Feature B.

How can I do that?

Sato
  • 8,192
  • 17
  • 60
  • 115

2 Answers2

0

Refer to the answer of Squash my last X commits together using Git

Or just google git squash.

I don't have computer in hand and so cannot try it for you.

Community
  • 1
  • 1
Landys
  • 7,169
  • 3
  • 25
  • 34
0

The command to make that is the following:

git rebase -i <ref>

This command will open your editor and show you every possible options to reorder/squash/rename... your commits.

Hope this will help you.

Here is the documentation about git rebase: git-rebase

Joël Salamin
  • 3,538
  • 3
  • 22
  • 33