0

I understand that a Git server is generally supposed to be a bare repository. According to https://stackoverflow.com/a/2538611/271577 , this may be merely a recommendation: "It is usually recommended that the remote repository be made bare as attempting to push to a branch which is checked out would cause the remote's working tree to become out of sync with its checked out branch."

I would assume though that a hook could cause the checked out branch to auto-merge changes.

One could thus have a more abbreviated pipeline whereby developers merely pushed changes to a single Git server for continuous integration and a Git hook was used to merge the changes (if passing tests) and immediately set up a web server based on the repo contents, instead of setting up a bare repository with a hook to prompt a separate repository to pull the changes and only then update the web server.

Are there any technical (or practical) reasons this approach wouldn't work out or that it would have its own limitations?

Brett Zamir
  • 14,034
  • 6
  • 54
  • 77
  • I don't know how to set up a web server. What would it be like, if during the process of setting up a web server several members push their own new commits to the current branch? If it's a compiling process that lasts quite long, what would it be like? If the new commits are accepted, the current version is gone and the files are changed during the process. If not accepted, the push fails. – ElpieKay Dec 14 '17 at 02:38
  • Thanks, these are some valid points to take into account. I think upon a developer committing, one might be able to use a hook that runs all tests and if any break, the branch is rejected (or pushed to a separate non-master branch). Otherwise, the branch gets merged, though perhaps only updating the working copy and restarting the web app on a cron task (so it restarts at a time when web traffic is low). – Brett Zamir Dec 15 '17 at 08:52
  • I found my answer at https://stackoverflow.com/questions/34574166/can-git-push-to-the-current-branch-of-a-remote-repository , so voting to close own question – Brett Zamir Dec 16 '17 at 12:34
  • Also helpful for background: https://stackoverflow.com/questions/804545/what-is-this-git-warning-message-when-pushing-changes-to-a-remote-repository/28262104#28262104 – Brett Zamir Dec 16 '17 at 12:34

0 Answers0