Reputation: 7853
In general when is one branch the upstream of another one?
git-rebase - Forward-port local commits to the updated upstream head
git rebase [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]
In the following the master is the upstream branch. But why is master upstream, what is the precise definition?
A---B---C topic
/
D---E---F---G master
Upvotes: 0
Views: 307
Reputation: 8200
The user selects what is the upstream for the branch to be rebased on. Any commit in the repo can be considered upstream for rebase operation even the one that is already part of the branch, for example:
git rebase -i HEAD~5
Will allow to rewrite last 5 commits of the current branch (change order, squash or remove some)
But one of the generic usages would be if you have a branch that tracks releases and your development branch and while you were developing, somebody created a release with new feature that your development branch doesn't have yet. In this case your dev branch should be rebased on the released state, i.e. upstream.
Upvotes: 1