Skip to content

Example rebase scenario

sbellity edited this page Jan 2, 2013 · 4 revisions

A quick word about your remotes

Git allows you to fetch and push to multiple repositories which may be at any stopping point. Some, including your own forked aura repo, will have it's own branches.

Go to your aura repository:

git remote add upstream git://github.com/aurajs/aura.git.

Some people have their origin set to their user repository. It's best to do a

git remote add <yourusername> git://github.com/<yourusername>/aura.git then you can

git push <yourusername>.

Let's rebase

git fetch upstream

fetch latest refs from the main repository.

git rebase -i upstream/master

it gives me an error, I already have a rebase in progress from earlier.

git rebase --abort

I cancel a prior rebase.

git rebase -i upstream/master

initiate a rebase, interactively / wizard mode, against the upstream (which is aurajs/master).

A file resembling a git commit message opens. I choose to pick or combine revisions and save the file.

git status

Checking to see what's uncommitted / needs manual attention.

vim spec/SpecRunner.html

Look for the >>>> which is where the diff is. Pick the code that is yours but make sure it's compatible with any changes in between. If someone changed a variable name in between the revision your branch is based off of and now, for instance, you would want to fix.

Nothing is uber complex, this is just git giving you the chance to compare the most recent code and your own changes by hand. When done, save.

vim src/aura/core.js

The other file that needed manual attention.

git status checking again

git add spec/SpecRunner.html src/aura/core.js

I add the diffs

git rebase --continue

The --continue moves to the next step or finishes the rebase process.

git push -u <yourusername> custom-sandbox-reflux:custom-sandbox-reflux-rebased

The remote is named <yourusername>. We push our change custom-sandbox-reflux to custom-sandbox-reflux-rebased on my repository.