Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I rebase without first calling fetch from origin?

Tags:

git

Here is the document for fetch

Fetching is what you do when you want to see what everybody else has been working on. Since fetched content is represented as a remote branch, it has absolutely no effect on your local development work.

The following example describes one of the standard methods for publishing local contributions to the central repository.

git checkout master
git fetch origin master
git rebase -i origin/master
# Squash commits, fix up commit messages etc.
git push origin master

Question> What if I don't call git fetch origin master since it doesn't change my local development work?

like image 563
q0987 Avatar asked Nov 30 '25 03:11

q0987


1 Answers

If you do not fetch, then your origin/master is not updated to the latest one. Then your rebase will probably do nothing (except for the --interactive part, squash, fix-up, etc, that's up to you and can be done), being likely a predecesor to your local master.

But when you do push it will likely fail, because your local master is not a successor of the real origin/master. And that's precisely the point of doing the rebase in the first place, to make your master a successor of origin/master.

like image 161
rodrigo Avatar answered Dec 01 '25 16:12

rodrigo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!