I keep my website in a Git repository. It’s just a small personal site so there’s no fancy automation; I’ll make a bunch of changes and then periodically push the site to the server using jekyll-s3. I do like to keep track of which revisions have been uploaded and which haven’t, and right now I have a branch called pushed into which I merge master each time I upload to the server. (If any other branches are involved I merge everything into master before pushing, so that only master ever gets merged into pushed.)
This works well enough, but it seems weird to me to be using an “entire” branch when all I care about is marking one commit at a time as “this has been pushed”. (Yes, I know that branches are considered very lightweight in Git.) Terminology-wise it seems like I want to “tag” the latest commit each time I upload to the server—except that in Git, a tag is supposed to be an immutable reference to one specific commit. Is keeping a branch called pushed the most idiomatic way to do what I’m trying to do, or is there a better way?
If I understood correctly, you want to have a reference to your last update on the website, right? Well, branching is in fact what they do, but not with the naming you have done.
As you may know, there are two major ways for development with version control systems:
masteris development branch. In this case, the stable releases are certain tags.masteris the stable branch. In this case, you have other branches for development. When you want to add your feature tomaster, you merge master with your own branch and test it. If it worked, you merge the results withmasterand push it to your website.What you are talking about is in fact the second method, where you have a stable branch named
pushedand you keep it stable (uploaded, working, whatever property you want) at all times.So, yeah what you do already exists, however more idiomatically, they keep
masteras that stable branch rather than some other branch (for example namedpushed). It’s the same concept though.Edit: What I’m saying is that, whenever you want to upload your changes to your website, merge whatever you have in
master(orpushedif you like), and then upload it. This way, the last commit ofmaster(orpushed) is the last upload of the website.