Local github got all messed up
It appears to be about 2 years since I set up the local github on the my internal network. Thank goodness for timestamps on blog posts! I've used it a bit, mostly for holding onto the code for the various websites I've created (see cookbook.bedewell.com for an example). All these sites use hugo to create them and I added some post-receive
hooks to auto-build the site (I'll add something on the blog about that at some point soon!). In addition I wanted to ensure that the website code was also up on github.com so that if something went really wrong I still had an off-site copy.
Hopefully you are already feeling nervous! Let's say that all that again! There is a git repo on your local machine, which is running on branch working
(you may recall that with git-daemon
you can't actually push branch master
to a repo - this may be something to look at changing in the future) that will push to a local shared repo, which will merge working
and master
, push to master
on github.com and then build the website!
So, what happened was that every time my local repo pushed to the shared repo it appeared to be unable to merge with master
, and when I logged onto the shared repo and investigated it appeared to have incorrect, uncommitted changes on working
. I would manually revert those changes, merge with master
, push to github.com and build. All would be in a good state on the shared repo, so I'd go back to my local repo, pull the correct stuff and try again. ... Same thing!
How weird was that! I kept playing around and even tried some re-basing on the shared repo. To no avail. Finally, with no great ideas left, I stumbled upon the issue. It appears that it is important that master
locally also be correct WRT the shared repo, and somehow my local master
branch wasn't quite getting updated correctly. So the fix? Locally, git checkout master
followed by git pull
followed by git checkout working
and git pull
put me in a working spot. But I still don't quite understand why git push
on my local working
branch would mess up the remote working
and master
in the way that it did!
Oh well - just one more joy of git!