Pedro Gordo
Pedro Gordo

Reputation: 1865

Pushed local branch shows as stale in remote

I'm working on a contribution to an open-source project. I have a branch with my stuff that I have pushed to my GitHub repository, and I can see it there (https://github.com/sedulam/CASSANDRA-13990). I'm pulling directly from the project source repository.
However, when I do git remote show origin it shows as stale:

laptop@pandaria:~/git/cassandra$ git remote show origin
* remote origin
  Fetch URL: https://gitbox.apache.org/repos/asf/cassandra.git
  Push  URL: https://github.com/sedulam/CASSANDRA-13990.git
  HEAD branch: trunk
  Remote branches:
    cassandra-1.0                   tracked
    cassandra-1.1                   tracked
    cassandra-1.2                   tracked
    cassandra-2.0                   tracked
    cassandra-2.1                   tracked
    cassandra-2.2                   tracked
    cassandra-3.0                   tracked
    cassandra-3.11                  tracked
    refs/remotes/origin/13990-trunk stale (use 'git remote prune' to remove)
    trunk                           tracked
  Local branches configured for 'git pull':
    13990-trunk merges with remote 13990-trunk
    trunk       merges with remote trunk
  Local ref configured for 'git push':
    trunk pushes to trunk (local out of date)

laptop@pandaria:~/git/cassandra$ git push
Everything up-to-date

laptop@pandaria:~/git/cassandra$ git status
On branch 13990-trunk
Your branch is up-to-date with 'origin/13990-trunk'.

nothing to commit, working tree clean

How do I link my local 13990-trunk to the branch I have on GitHub?

Upvotes: 1

Views: 127

Answers (1)

VonC
VonC

Reputation: 1326994

origin refers in your case to gitbox.apache.org, not github.com.

Do add github.com as a remote:

git remote add github https://github.com/sedulam/CASSANDRA-13990.git

And fetch (git fetch github), in order to get /refs/remotes/github/13990-trunk.

You can then create a local branch tracking the remote branch:

git checkout --track -b 13990-trunk github/13990-trunk

Upvotes: 1

Related Questions