Z
Z
zlodiak2019-08-17 16:11:42
git
zlodiak, 2019-08-17 16:11:42

Why can't you squash all commits?

There are several commits:

[email protected] ~/.MINT17/code/misc/force $ git hist
* d834360 2019-08-17 | 3 (HEAD, origin/master, master) [kalinin]
* bb0a0e2 2019-08-17 | 2 [kalinin]
* d84440e 2019-08-17 | 1 [kalinin]

I would like to squash three commits into one. I'm trying to do it like this:
[email protected] ~/.MINT17/code/misc/force $ EDITOR=/usr/bin/nano git rebase -i HEAD~3
fatal: Needed a single revision
invalid upstream HEAD~3

But git only allows this:
[email protected] ~/.MINT17/code/misc/force $ EDITOR=/usr/bin/nano git rebase -i HEAD~2
[detached HEAD e9ff86d] 2
 1 file changed, 2 insertions(+)
Successfully rebased and updated refs/heads/master.

As a result, I get the following result:
[email protected] ~/.MINT17/code/misc/force $ git hist
* e9ff86d 2019-08-17 | 2 (HEAD, master) [kalinin]
* d84440e 2019-08-17 | 1 [kalinin]

As you can see, there are 2 commits, but I needed one...
Please tell me why my task is unsolvable. Or explain how to solve it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-08-18
@zlodiak

git rebase -i --rootif you need to make changes to the first commit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question