cytofu
cytofu

Reputation: 903

git detached worktree commit changes

For website development I have a git repository on a live server, that I cloned to a dev server, that I cloned to my own PC for local development.

The repository on the dev server is a bare repository, that has a detached worktree that is checked out with a post-receive hook (to keep the git repository outside the public_html folder):

branch=$(git rev-parse --symbolic --abbrev-ref $1)
GIT_WORK_TREE=somepath/public_html git checkout -f $branch

I would usually do all work on my worksstation then push to dev and from there to live. Now there were some changes (updates) that were a lot easier to do on the dev server then on my pc. But how / or can I at all commit those changes, even though its a bare repo?

Upvotes: 1

Views: 92

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21938

You could go as follows :

  • in another directory on your server, clone the repo without the --bare parameter to have full capabilities on the clone (namely, a working tree)

  • set your bare repo as remote for the new clone

  • do whatever modifications you need on the clone

  • push to original bare repo

Upvotes: 1

Related Questions