Your branch and 'origin/master' have diverged?

Hello - I have a rudimentary understanding of Git, and recently pushed a local repository to GH Pages (to create a simple static HTML webpage).

After the initial commit, I made one text change to the “index.html” file and pushed that to GH Pages via the standard ‘git push’ command. This worked perfectly, and I thought everything was clear with using GitHub for this website …

However, yesterday I made another text change to “index.html” on my local machine, and tried the same method to push it up. To my complete surprise, I got a message saying that one branch was behind the other (something to that effect), and that I should do ‘git pull’ to sort it out.

Unfortunately, that didn’t work either (it happened fast and I’m a little fuzzy about the specifics), but I ended up aborting the process and nothing was committed.

So today I figured I should check the status, so I did ‘git status’ and here was the result:

On branch master
Your branch and ‘origin/master’ have diverged,
and have 2 and 1 different commits each, respectively.
(use “git pull” to merge the remote branch into yours)
nothing to commit, working tree clean

So then I did ‘git pull’, with this result:

Swap file “~/Sites/” already exists!
[O]pen Read-Only, (E)dit anyway, ®ecover, (D)elete it, (Q)uit, (A)bort:
Found a swap file by the name “~/Sites/”
owned by: JimB dated: Fri Aug 14 18:56:48 2020
file name: ~JimB/Sites/
modified: YES
user name: JimB host name: Jim-Bs-MacBook-Pro.local
process ID: 1918
While opening file “/Users/JimB/Sites/”
dated: Sat Aug 15 22:00:32 2020
NEWER than swap file!

(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r /Users/JimB/Sites/”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “/Users/JimB/Sites/”
to avoid this message.

Note: “” is not the actual directory name …

Anyway, I’m pretty confident that (1) is not the case here. I’m the only person who would know about or have access to this repository.

So I suppose that leaves (2) as the most likely explanation. Unfortunately, I have no idea what this means. I’ve used GitHub for a long time just doing simple commits like this one, and have never seen anything like this before.

So then given the choices, I chose “A” to abort, which yielded this:

error: There was a problem with the editor ‘vi’.
Not committing merge; use ‘git commit’ to complete the merge.
JimB@Jim-Bs-MacBook-Pro %

I’m pretty confused about what’s going on here, and definitely don’t know what to do next. And since I don’t want to mess anything up, I’m asking this question here.

Thanks for any assistance!

Just a quick update that I don’t need help anymore (though it’s unclear if any help was coming) …

I decided to follow the topmost answer at

And that fixed the problem in terms of resetting my local directory to match the master branch on GH Pages.

And then I realized there still needed to be a small text change to the “index.html” file, so I just changed that file locally and did ‘git add .’ plus ‘git commit -m “message”’ and then ‘git push’ …

It all worked perfectly, so hopefully everything will work now as expected going forward.