Technology sharing

[Git Study Notes] Caput 4 git emendare operationem et exempla cognata (Part 1)

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Caput IIII

related topic】

  • Will commit Rebase versio alii genere
  • Praestare rebase si versionis conflictu
  • Praestare interactive rebase in certa version
  • Interactive rebasing ad aggregatum versiones
  • Mutantur committers per interactive rebasing
  • Automatic aggregatio versionis

4.0 Introductio ad rebasing

Rebase (Rebasing ) Git notum validissimum est.Rebasing genus operandi est: si acommit A Primum est secundumcommit B de;A Rebase estCid est, voluntatem A facti sunt secundumC operationem.

In casu sequenti demonstrationis invenies saepe correctionem non tam facilem esse quam videtur.

4.1 voluntatem commit Rebase versio alii genere

Primum inspiciamus genus simplicissimum rebasionis operationis. Praeparatio operis relativa: novum fasciculum indo, submittere, mutare materiam, et iterum submittere.Hoc modo bis sunt locicommit Versionem.

Adhuc cum jgit Bibliotheca exempli gratia:

# Clone jgit repo into chapter4
$ git clone https://git.eclipse.org/r/jgit/jgit chapter4
$ cd chapter4
# Checkout a new branch
$ git checkout -b rebaseExample --track origin/stable-3.1
# Create the 1st commit
$ echo "My Fishtank
    
Gravel, water, plants
Fish, pump, skeleton" > fishtank.txt
$ git add fishtank.txt
$ git commit -m "My brand new fishtank"
# Create the 2nd commit
$ echo "mosquitos" >> fishtank.txt
$ git add fishtank.txt
$ git commit -m "Feeding my fish"
# Rabase to stable-3.2
$ git rebase origin/stable-3.2
Successfully rebased and updated refs/heads/rebaseExample.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

Ante rebasing:

Insert imaginem descriptionis hic

Post reasing:

Insert imaginem descriptionis hic

git rebase Processus exsecutio;

  1. conversus sursum HEAD Communis versio inter scopum ramum ab rebase demonstratum (merge-base);
  2. fundatur merge-basereperi omnes versiones absentes in clypeo ramo;
  3. Conare versiones absentes applicare singulatim ad scopo germen.

4.2 Faciendo de versionis confligit si rebasing

Si a * commit versionem vel a *branch Rebase genere ad aliumHEAD certamina versionis evenire solent.Hic certandum est solvendum et mandatumgit rebase --continuequod diminutio absolvi potest.

Exempla in hac sectione demonstrant quomodo ad effectum deducendi coram pugnis.Post exitum finalem demonstratum in Section 4.1, hoc temporerebaseExample De genere rebasted eststable-3.2 ramum.Exemplum probabit ramum novum a stabili-3.1 et adde etrebaseExample Textus fasciculi in eodem genere nominis sed incompossibilia contentafishtank.txt

# Checkout rebaseExample2
$ git checkout -b rebaseExample2 --track origin/stable-3.1
# Add a new commit
$ echo "My Fishtank
Pirateship, Oister shell
Coconut shell
">fishtank.txt
$ git add fishtank.txt
$ git commit -m "My brand new fishtank"
# Rebase conflicting branches
$ git rebase rebaseExample
Auto-merging fishtank.txt
CONFLICT (add/add): Merge conflict in fishtank.txt
error: could not apply 24f9bf1ef... My brand new fishtank2
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 24f9bf1ef... My brand new fishtank2
$ subl fishtank.txt
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

Certaminum condicio talis est;

Insert imaginem descriptionis hic

Muta ad sequentia contenta, salva et claude;

Insert imaginem descriptionis hic

Add in merged lima ac continue rebasing:

$ git add fishtank.txt
$ git rebase --continue
hint: Waiting for your editor to close the file...
  • 1
  • 2
  • 3

Editor aperiens in figura ostenditur:

Insert imaginem descriptionis hic

Confirma, serva et claude, et videbis quod emendare promptum fuit;

$ git rebase --continue
[detached HEAD 9911772b3] My brand new fishtank2
 1 file changed, 2 insertions(+), 3 deletions(-)
Successfully rebased and updated refs/heads/rebaseExample2.
# Check new status via gitk
$ gitk
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Singula sunt haec:

Insert imaginem descriptionis hic

In hac rebase videri potest, solum versiones quae in veteri ramo insunt, sed non in novo ramo reponendae (id est, novae versiones addendae sunt) commit)。

In git promptum indicium primae interpellationis retractare, etiam duo videre potes;

  1. git rebase --abort: Sensus litteralis, rebase interrumpere

  2. git rebase --skip: Skip contentiones et rease directe, quod evenit in rebaseExample2 Relinquere novumcommit, Protinus immiscet rebaseExampleet cum deprauata monstraret parentem rebaseExample Congruunt:

    Insert imaginem descriptionis hic


4.3 Interactive rebase in certa version

Hoc exemplo utimur rebaseExample Ex ramis, demonstra uti--interactive Marcus, duos rease in 4.1commit Rebase ad remotis tracking generestable-3.1 superior;

$ git checkout rebaseExample
Switched to branch 'rebaseExample'
Your branch is ahead of 'origin/stable-3.1' by 109 commits.
  (use "git push" to publish your local commits)
$ git rebase origin/stable-3.1
  • 1
  • 2
  • 3
  • 4
  • 5

Hoc tempore, index commentarium in recenti pop-up editore exhibebitur, cum range rebaseExample etstable-3.1 inter omnia potest rebased eststable-3.1 of *commit Record.Serva duos novos in exemplocommitreliquos omnes dele (id est linea 89 et ante);

Insert imaginem descriptionis hic

Post salvificum, editor exite et sequentia output videbis:

$ git rebase --interactive origin/stable-3.1
Successfully rebased and updated refs/heads/rebaseExample.
# Check in gitk view:
  • 1
  • 2
  • 3

Effectus est talis:

Insert imaginem descriptionis hic

Exemplum extensio

In hoc exemplo potes etiam cito consequi effectum optatum per mandatum;

$ git rebase --onto origin/stable-3.1 origin/stable-3.2 rebaseExample
Successfully rebased and updated refs/heads/rebaseExample.
  • 1
  • 2

Tabula ante et post retractationem talis est:

Insert imaginem descriptionis hic