Question

I'm on a 32-bit Windows 8 system, running GitHub for Windows. My repository's master branch has an HTML file. I activated GitHub's web page service. To serve my web page, I switched to my "gh-pages" branch, and ran "git checkout master -- MyWebPage.html" then did a commit & sync.

Now, I updated my web page on the "master" branch. When I tried to re-copy the file to the "gh-pages" branch, nothing happened! It didn't copy since the file is already there. I guess it doesn't consider the updated state.

How do I re-copy across the branches, using the latest? The web page is the only file common to both branches. I've heard of something called "merge," but it may work at the branch level, and I do not want all the files of the "master" branch to be copied over, just the web page I already did.

Was it helpful?

Solution

Looking at my (first) two comments on the question, I figured it out.

  1. I changed the web page by using GitHub's "directly edit from GitHub's web pages" feature.
  2. That means that my local copy of the "master" branch does not have that change.
  3. So "git checkout master MyWebPage.html" just copies an unchanged file.
  4. I switched to "master," used sync to get the new commit, switched back to "gh-pages," then "git checkout master MyWebPage.html" again. This time, it worked!

So I learned that copying among branches only does the local versions. Remote updates are not included.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top