-4

i cloned a friend's repository from github and worked upon it. the repository has master and Dev branches. I'm pushing my changes to the Dev branch by

git push -u origin Dev 

but keep getting error :

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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Irfan Harun
  • 979
  • 2
  • 16
  • 37
  • 1
    So did you try integrating the remote changes, as the error suggests? Have you read any of the other questions about this message? – jonrsharpe Jan 12 '19 at 10:39

1 Answers1

1

Basically since you have created the local branch, some more changes have made it to the Dev branch because of which you are getting the error that the current branch is behind remote.

You just have to pull down the changes and then try to push again.

git pull --rebase

=> Removes your changes, updates you branch to the latest and the applies all your changes.

git push origin Dev
   => Pushes your changes to the remote branch

If you donot want to rebase, you can try git pull which will bring down all the changes to update your local branch and in process it will create a merge commit.

Personally i follow the git pull --rebase and git push sequence mostly.

rks
  • 542
  • 1
  • 3
  • 13