logoalt Hacker News

orthoxeroxyesterday at 8:37 PM2 repliesview on HN

I had to make an alias for rebasing, because I kept doing the opposite:

    git checkout master #check out the branch to apply commits to
    git rebase mybranch #Apply all commits from mybranch
Now I just write

    rebase-current-branch
and it does what I want: fetches origin/master and rebases my working branch on top of it.

But "ours"/"theirs" still keeps tripping me up.


Replies

cervedyesterday at 10:49 PM

Tip, you may want to use origin/HEAD over origin/master

show 1 reply
skydhashtoday at 2:56 AM

You can use the --onto flag for git rebase

  git rebase --onto origin/master
It will checkout origin/master and replay the current branch on top.

P.S. I had to check the man page as I use Magit. In the latter I tap r, then u. In magit my upstream is usually the main trunk. You can also tap e instead of u to choose the base branch.