Make files in web server match a certain git commit -


i trying set web server download particular version of website. need on server able issue command make folder match commit.

i've tried searching this, seems there lots of info on git, , many different answers. i'm not sure answer is, or correct answer is.

this find work, it's seems bit convoluted.

git fetch origin git checkout {hash} git pull 

is there better way? , work in situations (state of repo, etc)?

to clarify don't need make commits on web server, needs receive.

you can use git reset --hard put working directory exact state of commit. following on server when deploying version (usually automated):

git fetch origin git reset --hard origin/master 

this overwrite tracked files version fetched origin/master.

note not remove untracked or ignored files. if need that, need run git clean afterwards:

git clean -xdf 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -