-
Notifications
You must be signed in to change notification settings - Fork 1
Advanced Editing
This is the more cut-and-dry, techie-oriented doc around editing the site. Is it useful to have as part of the docs?
If you haven't already gone through the Basic Editing and Files & Directories Guide, and Building & Serving the Site docs, you should probably do read those the first.
Now that we're set up, we can work on the changes locally, push them to staging, and then once all is good, push to the production site.
- Run
git fetch --allto get a record of any changes that were made to the branches currently on your local environment. This will show you something like the following:
Fetching origin
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0
Unpacking objects: 100% (3/3), done.
## Here's the part we're looking for ##
From https://github.com/pgpglobal/PGPGlobal
06e5b6e2..7c70bbb3 master -> origin/master
06e5b6e2..7c70bbb3 gh-pages -> origin/gh-pages
Fetching staging
From https://github.com/pgpglobal/staging
8423748e..7c70bbb3 gh-pages -> staging/gh-pages
Whichever branches have been changed will show up here. So in the example above, the following have changed:
origin/masterorigin/gh-pagesstaging/gh-pages
Most of the time after doing this, you should just be able to git pull (fetch and merge changes). The exception will be if you have changed a file locally and the file has separately been changed on the remote repo. If you run into that, see Using Git - Solving Merge Conflicts.
- Create a branch for the feature you're working on. Ex: if you're working on a post, you might type
git checkout -b abbrev-post-name. If you're making changes to the menu, you might typegit checkout -b luna-nav-menuornav-menu-fix, etc. - Once you've made your changes, run
bundle exec jekyll serveto test it out locally - If everything looks good, then switch to
staging, merge the new changes, and push tostaging/gh-pages. Example:
# Let's say we named our branch new-feature
# Go back to the main staging branch
git checkout -b staging
# Bring in the new changes
git merge new-feature
# Push the changes to the staging site.
# If you set push.default earlier, then simply git push
# Otherwise:
git push staging HEAD:gh-pagesNote: If you think you're going to have multiple people working on new staging features at the same time, and are worried about running into merge conflicts, then instead you can do as follows:
- Make the new feature branch
git checkout -b new-feature - Make your changes
- Test locally via
bundle exec jekyll serve - Push the
new-featurebranch to the remote staging repo. Ex:git push new-feature staging/new-feature - Sign into the GitHub Repo and make a Pull Request to integrate the new feature into the main branch. You'll need a maintainer to do this.
I think this alternative workflow may ultimately be redundant, as long as everyone is running git pull and/or git fetch properly
After everything looks great on the staging site, and you've incorporated everything into the (local) staging branch, then push those changes to the (remote) staging/master branch. This serves as a backup, so that if something gets messed up later with the gh-pages branch, we have a stable working version of the site.
- Return to your (local) master branch
git checkout master - Merge the changes from the staging site
git merge staging - Test that the changes are working correctly via
bundle exec jekyll serve - If everything's working correctly then
git push origin master, and setup a pull request on GitHub - The project maintainer can then pull those changes into the (remote)
masterbranch, and once that's ready can push them to thegh-pages.
If you want to make this less redundant, then people can simply do git push origin master and the maintainer can git pull origin master, make sure everything's working fine and then git push origin gh-pages