git-step-by-step
  • Introduction
  • Git Remote
  • Branch
  • Checkout & Reset
  • SSH Key
  • Branch
  • Diff & Merge
  • Commit
  • Log
  • Rebase
  • Fetch
  • Reflog
  • Tag
  • Stash
  • Configure Sublime for Linux
Powered by GitBook
On this page

Was this helpful?

Rebase

Make linear history

EX- c1->c2->c3->c4->c5

Branch was created when master was on c2, if want to have brnach history ( b1, b2 ) starting from c5 do rebasing

// for doing rebase you want to switch to branch
my-branch> git rebase master|commit-hash

// after rebase
git checkout master
git merge my-branch ( will do fast forward merge)
git branch -d my-branch
(now you have completely linear history c1->c2->c3->c4->c5->b1-new->b2-new)

Rebase Conflict merge

my-branch> git rebase master|commit-hash
(assume conflit)

// have 2 option now, after conflict current branch status will change to conflict state
git rebase --abort ( go bach to prior rebase state )
// or resolve conflict(git mergetool) than
git rebase --continue
PreviousLogNextFetch

Last updated 4 years ago

Was this helpful?