理論
それでは、リベースとは何かという理論的な知識を更新しましょう。 簡単に説明すると、 マスターと機能の 2つのブランチがあります 。両方ともローカルです。機能は状態Aのマスターから作成され、コミットC、D、およびEが含まれます。 。

機能ブランチでリベースマスター操作を適用すると、コミットツリーは次のようになります。

コミットC '、D'、およびE 'は、C、D、およびEとは異なり、ハッシュが異なりますが、それらの内部で実行される変更(デルタ)は理想的には同じであることに注意してください。 コミットの違いは、ベースが異なるという事実(最初の場合-A、2番目-B)によるものであり、デルタの違いは、リベース中に発生した競合状況の解決によるものです。 これについては後で詳しく説明します。
この状態には、最初の状態よりも重要な利点が1つあります。機能ブランチをマスターブランチにマージする場合、早送りでマージできます。これにより、この操作中の競合がなくなります。コミットBのマスター
リベースプロセスの詳細
さて、このプロセスの仕組みを見てみましょう。ツリー1はどのようにツリー2に変化したのでしょうか?
リベースする前に、機能ブランチにいることを思い出させてください。つまり、HEADは機能ポインターを確認し、その機能ポインターはコミットEを確認します。マスターブランチの識別子を引数としてコマンドに渡します。
git rebase master
git — . A. HEAD git , A , ΔAC. master. , C', C' = B + ΔAC. master feature , , HEAD (C'), « » (detached HEAD).

C', git — ΔCD. , C' . rebase ( , git status , detached HEAD). , ΔCD ( ) ( stage-):

:
1. rebase
git rebase --abort
HEAD, feature, ( ) .
2. merge-tool', ,
git add %filename%
. , rebase-
git rebase --continue
, , D' rebase , .
3. , B D , «» B,
git rebase --continue
, , . D',
git rebase --skip
ΔDE E', feature E', HEAD feature — , , rebase . C, D E .

, rebase-, (Author), , rebase (Commiter):
commit 0244215614ce6886c9e7d75755601f94b8e19729 Author: sloot69 <***@****.com> AuthorDate: Mon Nov 26 13:19:08 2012 +0400 Commit: Alex <***@****.com> CommitDate: Mon Nov 26 13:33:27 2012 +0400
— rebase
, : master, origin/master, feature origin/feature. rebase origin-, feature origin/feature, feature master.
Rebase origin-
rebase, . , , , - merge. :

— 3 master . 1 . .
git push origin master
, , . (2 3)
git pull origin master
, merge- . git push . git pull, merge-. ,
git push origin master
. github, network, :

6 ( ), , , , . , , , :

. rebase?
git pull origin master
git pull --rebase origin master
, , C, D E origin/master,
git push origin master
. :

, «» merge- , C C'. C , C'.
git pull --rebase
, .
, rebase
rebase- master . , rebase . , merge, (master). rebase . , ? push , fast-forward, , , :

, :
git push origin feature --force
Force- feature origin , .
! , force-push , . , . , origin-. , — . — , . push, origin. , .
, pull, push. feature origin/feature .
git pull origin feature
, merge. , . :
git pull --rebase origin feature
feature .
git pull --rebase origin feature
— , rebase , fast-forward.
master
rebase. master git merge feature. , rebase- master fast-forward, .
, — merge fast-forward , , , . — merge --no-ff. merge-, master, — feature. , fast-forward () c merge-, --no-ff ():


, , merge- . , .
, , .
git rebase , , , merge- , rebase ( -, ) , , , git pull --rebase.
. — master , . , rebase- . .
, merge rebase . , , . , . rebase-, . , , rebase .
PS. , , .