简体   繁体   中英

git local branches does not 'merges with the right remote branches'

I create 2 local branches to track remote branches:

# git branch1 -t origin/branch1
# git branch2 -t origin/branch2

But after I do a 'repo sync' and I do a git remote show origin , I see my branches are 'merges with remote dev, not branch1 and branch2' and they are 'pushes to' correctly' but it said 'local out of date'.

  # git remote show origin
  ...
  Local branches configured for 'git pull':
    branch1 merges with remote dev
    branch2     merges with remote dev
  Local refs configured for 'git push':
    branch1 pushes to branch1 (local out of date)
    branch2     pushes to branch2     (local out of date)

how can I get my branches (branch1, branch2) to 'merges with the right branches'? And get my 'local no longer 'out of date'?

Thank you.

I think the important thing to note is that you are typing git branch regardless of what your branch is named. git branch1 is never a correct command.

You want this:

git branch -t origin/branch1

Alternately, you can do this if you want to check the branch out immediately:

git checkout -t origin/branch1

Also, if you already have a local branch, and want to set it to track a remote branch (rather than checking it out as new from the remote branch), you can do this:

git branch -u upstream/branch1 localbranch1

Please note that this syntax has recently changed and some of these commands will only work with Git 1.8.0+.

branch1 merges with remote dev消息branch1 merges with remote dev并不表示你的分支origin/dev的合并,但是如果你在当前运行时运行git pull而没有指定分支,那个origin/dev将合并branch1的默认分支branch1合并。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM