Reputation: 5301
I made some commits in my local repo and have pushed them to the online repo too.
Then i realized that there are to many commits and i want to squash them into little. Preferably from second last one
to first one
. i.e. keeping current commit and squashing all other my commits.
when i do
git rebase -i origin/branch_name
Window with noop
pops up. I do not see any pick
. What should i do ?
Upvotes: 5
Views: 25111
Reputation: 6695
When I get the noop
message, it usually means the branch used in the argument of git rebase -i
is ahead of checked out branch.
git log A..B
# prints the commits between A's head and B's head
git log B..A
# prints nothing
git status
# On branch A
git rebase -i B
# got 'noop' because there are no commits in the log above
In this case, it helps to swap the two affected branches.
git checkout B
git rebase -i A
Upvotes: 4
Reputation: 39396
The argument for the rebase command is the range of commits you want to squash. In your case, probably something like :
git rebase -i <sha-1 for first commit>..HEAD^
(HEAD^ being the parent commit to the head of your branch).
Then, you replace the pick
commands in the interactive script by squash
Upvotes: 0