Andrew Kim
Andrew Kim

Reputation: 3335

can't git push, pull says up to date: Current branch is behind it's remote counterpart

I've been working on a feature branch. I thought I had pulled everything before I started working(still relatively sure I did). When I go to push to the remote branch I get:

$ git push upstream upstream/attendance-enums:attendance-enums
To [email protected]:ga-dc/garnet.git
 ! [rejected]        upstream/attendance-enums -> attendance-enums (non-fast-forward)
error: failed to push some refs to '[email protected]:ga-dc/garnet.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

Then I tried:

$ git pull upstream attendance-enums
From github.com:ga-dc/garnet
 * branch            attendance-enums -> FETCH_HEAD
Already up-to-date.

Basically I know that I want my latest commit to be a PR to master, but there's a merge conflict on the github end

Additionally, what started all of this was I originally did a

$ git push upstream attendance-enums

This caused a merge conflict on github. But I can't figure out how to resolve the merge conflict in the command line.

Any ideas?

Upvotes: 2

Views: 788

Answers (1)

David Deutsch
David Deutsch

Reputation: 19035

I believe your issue is that you are specifying a remote branch when you should be specifying a local one (when you did your push), and visa versa (when you did your pull). Try doing the following:

git fetch upstream
git merge upstream/attendance-enums
git push upstream attendance-enums

Upvotes: 1

Related Questions