-1

I have two repo branches namely develop and master locally and in github(remotely). But with a major difference.

Local

 master  : identical to last working and stable develop branch
 develop : development branch

Remote

 master  : used the following command for this `git subtree push --prefix dist origin master`

 develop : development branch

Now my colleague cloned the master branch in his machine and updated a single file, the pushed to remote master branch.

Then I thought, oh okay, that is fine, I can just do:

git subtree pull --prefix dist origin master

Since it is just the opposite of the previous push command, but it gave me a conflict on the updated file, then I thought, okay I'll just fix and merge the conflict then subtree push again, but it gave me:

error: failed to push some refs to 'git@github.com:user/xxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

What could be the problem? Is there a right way to do this.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
Joey Hipolito
  • 3,108
  • 11
  • 44
  • 83

1 Answers1

0

If you have already made some commits, you can do the following

git pull --rebase

This will place all your local commits on top of newly pulled changes.

Elnaz
  • 1,095
  • 1
  • 12
  • 30