При перебазировании git повторяет коммит один за другим. Важно понимать, что он фиксирует один за другим, а не файл один за другим.
Я не уверен, что git переходит к первому коммиту на ветке при перебазировании этой ветки и скрывает остальные коммиты на этой ветке, пока перебазирование не будет выполнено.
Да, вот что происходит. Это сделано для того, чтобы вы могли выполнять слияние в каждом коммите отдельно.
Еще немного о перебазировании atlassian .
Вот небольшой сценарий
>git init repo666
Initialized empty Git repository in /mnt/c/git/repo666/.git/
>cd repo666/
(master)>echo 'Hello World!' > a.txt
(master)>cat a.txt
Hello World!
(master)>git add a.txt
(master)>git commit -m "1st commit in master"
[master (root-commit) 3c088b8] 1st commit in master
1 file changed, 1 insertion(+)
create mode 100644 a.txt
(master)>git checkout -b branch_b
Switched to a new branch 'branch_b'
(branch_b)>echo 'Bees are best (1)' > b.txt
(branch_b)>git add b.txt
(branch_b)>git commit -m "1st commit in branch b"
[branch_b 1380e52] 1st commit in branch b
1 file changed, 1 insertion(+)
create mode 100644 b.txt
(branch_b)>echo 'Bees are best (2)' >> b.txt
(branch_b)>git commit -am "2nd commit in branch b"
[branch_b 3cd723d] 2nd commit in branch b
1 file changed, 1 insertion(+)
(branch_b)>echo "I'm being changed in branch b!" > a.txt
(branch_b)>echo "I'm b.txt and I'm being changed in the same commit with a.txt (in branch b)" > b.txt
(branch_b)>git commit -am "3rd commit in branch b, changed both a.txt and b.txt"
[branch_b 5864038] 3rd commit in branch b, changed both a.txt and b.txt
2 files changed, 2 insertions(+), 3 deletions(-)
(branch_b)>echo "Bees are best again" > b.txt
(branch_b)>git commit -am "4th commit in branch b. b.txt has changed again"
[branch_b e32af63] 4th commit in branch b. b.txt has changed again
1 file changed, 1 insertion(+), 1 deletion(-)
(branch_b)>git checkout master
Switched to branch 'master'
(master)>echo "I'm being changed in the 2nd commit in master" > a.txt
(master)>git commit -am "2nd commit in master. Changed a.txt"
[master f2849fc] 2nd commit in master. Changed a.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Давайте посмотрим на нашу историю.
(master)>git log --pretty=oneline --abbrev-commit --reverse
3c088b8 1st commit in master
f2849fc (HEAD -> master) 2nd commit in master. Changed a.txt
(master)>git checkout branch_b
Switched to branch 'branch_b'
(branch_b)>git log --pretty=oneline --abbrev-commit --reverse
3c088b8 1st commit in master
1380e52 1st commit in branch b
3cd723d 2nd commit in branch b
5864038 3rd commit in branch b, changed both a.txt and b.txt
e32af63 (HEAD -> branch_b) 4th commit in branch b. b.txt has changed again
(branch_b)>git rebase --interactive master
Auto-merging a.txt
CONFLICT (content): Merge conflict in a.txt
error: could not apply 5864038... 3rd commit in branch b, changed both a.txt and b.txt
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 5864038... 3rd commit in branch b, changed both a.txt and b.txt
Теперь, если мы посмотрим на b.txt, содержимое получено с 3-го (а не 4-го) коммита в ветви b.
(branch_b|REBASE-i 3/4)>cat b.txt
I'm b.txt and I'm being changed in the same commit with a.txt (in branch b)
(branch_b|REBASE-i 3/4)>
Если мы продолжим ребазинг, будут применены изменения в b.txt
в 4-м коммите.