Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase from a url/path

Tags:

git

Why can I not rebase from the same location that I can pull? For example, if I am in a pository I can pull from another repository:

git pull /path/to/other

But I cannot rebase from that other repository; the following fails:

git rebase /path/to/other

The help for rebase doesn't mention any refspec's, so I don't know how, or even if, I can/should specify them.

How can I rebase from a different location?

like image 912
edA-qa mort-ora-y Avatar asked Apr 23 '12 11:04

edA-qa mort-ora-y


2 Answers

That's because git pull and git rebase do completely different things.

What git pull does:

  1. Retrieve commits from some remote repository and place them into remote-tracking branches.
  2. Merge the remote-tracking branch corresponding with the current branch into the current branch.

What git rebase does:

  1. Move commits from the current branch on top of another branch.

(In both cases, those are just the defaults.)

The main difference is that git pull operates on remote repositories, while git rebase operates on branches. That's why git rebase /path/to/other doesn't work, /path/to/other is not a branch.

But if you want to do what git pull does, except you want to do rebase instead of merge, you can do that: use git pull --rebase.

like image 127
svick Avatar answered Oct 27 '22 09:10

svick


git pull --rebase /path/to/other
like image 25
Fred Foo Avatar answered Oct 27 '22 08:10

Fred Foo