Раньше я все время использовал git rebase -i
, но вдруг он перестал работать.
git rebase
не работает ни в одном из моих проектов, что странно, и я подозреваю, что с моим git что-то не такконфигурация (?)
Я создал test
репозиторий, чтобы показать, что я делаю.
В тестовом репозитории у меня есть 2 коммита
$ git log
commit 8fb921a9a481ef1040ee670af7894bff6055a5b4 (HEAD -> master, origin/master)
Author: Bu Kinoshita
Date: Fri May 25 11:26:05 2018 -0300
test 2
commit 00ffa75caccf0118b9e89bc2bb70c4a7417b223a
Author: Bu Kinoshita
Date: Fri May 25 11:25:39 2018 -0300
test
А затем git rebased
с хешем коммита от первого коммита
git rebase -i 00ffa75caccf0118b9e89bc2bb70c4a7417b223a
pick 8fb921a test 2
# Rebase 00ffa75..8fb921a onto 00ffa75 (1 command)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
Измените первую строку на squash 8fb921a test 2
и сохраните файл.
Появляется ошибка
error: cannot 'squash' without a previous commit
You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
Or you can abort the rebase with 'git rebase --abort'.