开发者

Git for Web Developing

I'm attempting to create a set of git repositories and web folders in a server using the post-update hook. It would be something like:

//server/dev (for dev files) and //server/web (the apache main path)

The post-update hook for the //server/dev git repositories:

#!/bin/sh

unset GIT_DIR
PROJECT=`basename $(pwd)`
cd ../../web/${PROJECT}

echo "Updating `pwd`..."
git reset --hard

I see the update message while push开发者_JAVA百科ing stuff, but the //server/web folder just won't update. It keeps showing the first commit HEAD.

"HEAD is now at XXXXXXX First Commit"

There's some solutions around, but I can't seem to get it to work properly.


If the repository is at some point at the last commit, then updates are made, and you pull, the pull should always be a fast-forward, which by definition cannot cause merge conflicts. The only case in which it's not is when you push a non-fast-forward update into your central repository, which you generally should not do.

Of course, you might as well plan for the worst, and make absolutely sure that this will work, even with non-fast-forward updates, so you could do:

git fetch
git reset --hard origin/master
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜