Git rebase origin / develop vs git rebase develop

Suppose the current branch is MyFeatureX. And the local branch is developupdated with the source. Will the two statements below be equivalent? What is the recommended syntax?

git rebase origin/develop 
git rebase develop 

Please note: this is not the same question as git rebase origin vs .git rebase origin / master

+4
source share
3 answers

Your local branch is develop tracking origin/develop , and they may not always have the same commits in them.

$ cat ~/.git/config

[remote "origin"]
    url = git@something.com/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*

This means that we have a "remote" (a repository living somewhere else), arbitrarily called "origin."

develop , origin/develop. , . develop, . pull:

$ git status
    on branch develop
$ git pull
    ...pulls latest changes from origin

a git pull : a fetch a merge. , , - ,

git fetch origin

origin/develop, develop.

" " .git, "origin/develop".

, origin, git merge origin/develop. , " ", , git , origin origin/develop . , git.

, develop, , (), origin/develop.

:

git fetch --all
git rebase origin/branchname

, , , . , develop, git pull .

+8

develop , origin/develop, . origin/develop, develop (, origin/develop).

+2

() "rebase -onto ABC " " rebase ABC"?, --fork-point, , develop, origin/develop - , .

Omitting the argument <upstream>by default disables it --fork-point, and a reflog for a branch configured upstream can contain a lot of data. In this case, they can act in a completely different way. By adding explicit --no-fork-point, you can prevent git merge-base --fork-pointdropping commits removed from the upstream.

+1
source

Source: https://habr.com/ru/post/1671560/


All Articles