Unfortunately push-to-checkout did not result files in workdir after 
pushing to server, so it was not usable for me.


push-to-checkout file content:
#!/bin/sh
export GIT_WORK_TREE=/domains/site/test-workdir/.
export GIT_DIR=/domains/git/site-bare.git/
cd $GIT_DIR
git checkout -f


The steps I do:
$ git status
On branch master
Your branch is up-to-date with 'web/master'.
nothing to commit, working directory clean


$ git push web
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

root@192.168.1.101 password:
Everything up-to-date


# On server:
ls /domains/site/test-workdir
# empty result, push did not check out the content into the workdir 


# On local repo (add a file to commit):
touch 1test/test6


$ git status
On branch master
Your branch is up-to-date with 'web/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        1test/test6

nothing added to commit but untracked files present (use "git add" to track)


# stage it
$ git add .


# commit
$ git commit -m "test6 commit"
[master 30d1de6] test6 commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1test/test6


# now push to remote
$ git push web
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

root@192.168.1.101 password:
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 298 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh:root@192.168.1.101/domains/git/site-bare.git
   9f9ab91..30d1de6  master -> master



# On server:
ls /domains/site/test-workdir
# empty result, push did not check out the content into the workdir 
# at this point, using post-receive or post-update hook, the workdir 
content appeared.

The example above shows, that push-to-checkout does not work as I wanted, 
no files updated in workdir, even if there was a commit.


It seems, that post-receive or post-update hook is what somewhat works for 
me.
My problem with post-receive is, that it needs a commit to be able to 
update content of workdir.

Any idea how to trigger a workdir update with a single
git push web 
command?


Thanks,
Konrad

2015. április 28., kedd 11:21:58 UTC+2 időpontban Thomas Ferris Nicolaisen 
a következőt írta:
>
> I didn't get into the details of this discussion, but I just wanted to 
> shoot in that there is a new hook since Git 2.3 called "push-to-checkout". 
> Perhaps that would be the right thing here. Nice to know about anyhow:
>
> https://github.com/git/git/commit/0855331941b723b227e93b33955bbe0b45025659
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to