Your branch and 'origin/master' have diverged? #22704
-
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:
So then I did ‘git pull’, with this result:
Note: “myname.com” 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:
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! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 https://stackoverflow.com/questions/19864934/git-your-branch-and-origin-master-have-diverged-how-to-throw-away-local-com 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. |
Beta Was this translation helpful? Give feedback.
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 https://stackoverflow.com/questions/19864934/git-your-branch-and-origin-master-have-diverged-how-to-throw-away-local-com
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.