Git workflow in use
Let’s take this hugocms_docs repository as an example repository.
Git repositories configuration
Say you have already (tipically from Github) git cloned the repository to cooperate on
$ git clone git@github.com:/jhvanderschee/hugocms_docs.git
Let’s see the remote origin repository
cd ~/hugocms_docs
$ git remote -v
origin git@github.com:/jhvanderschee/hugocms_docs.git (fetch)
origin git@github.com:/jhvanderschee/hugocms_docs.git (push)
Let’s add the remote production repository
$ git remote add production hugocms@AMS01.usecue.nl:site.git
Let’s see both remotes, as expected to become
$ git remote -v
origin git@github.com:/jhvanderschee/hugocms_docs.git (fetch)
origin git@github.com:/jhvanderschee/hugocms_docs.git (push)
production hugocms@AMS01.usecue.nl:site.git (fetch)
production hugocms@AMS01.usecue.nl:site.git (push)
Edit content and ‘push’ test
Now edit and do some minor change test in the content, and try to publish it
$ git push production main
[..]
and Mr. Git says, uops
To AMS01.usecue.nl:site.git ! [rejected] main -> main (fetch first) error: failed to push some refs to ‘AMS01.usecue.nl:site.git’ hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., ‘git pull …’) before pushing again. hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.
It looks like this time we should first
$ git pull && git pull production main
Mr. Git answer is in this case, that there were found updates that were rejected because the remote contains work that another author did, as its message warns us
“[..]not have locally. This is usually caused by another repository pushing in parallel. You may want to first integrate the remote changes hint: (e.g., ‘git pull …’) before pushing again.
Git needs to know how you want him to do so, as long as different strategies (‘fast forwarding, ‘rebasing’, etc..) related on how git stores the repository changes history are possible. Let’s instruct him and then pull again :
$ git config pull.rebase false
$ git pull && git pull production main
Now we’ve got the remote changes merged locally and we can push ours to both Github and production server at once.
$ git push origin main && git push production main
Summary
As already said, this CMS does not only use Git, it is truly ‘git based’ and supports not only git commits, but also git commit messages with their proper authors, either in the role of editors (typically via the web browser) or in the role of developers. Or both of them!.