Divergent branches on github

14 Views Asked by At

I'm new to github and I had some questions. I started working on a branch and forgot to do gitpull to update the local repository to match the remote repository. This is what I did.

I did a git commit and when I pushed the changes it said:

Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

I then did git pull and got this message:

hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only

Since I now have divergent branches, I was wondering how I resolve this. I was thinking to cancel my commit, do a git pull to download the changes someone else made (so that my local repository matches the remote repository) and then commit my changes again. However I'm a bit lost on how to do this. Any help would be greatly appreciated.

0

There are 0 best solutions below