Run git commands on the remote working tree (GIT_WORK_TREE = / path)

I have a git repo head that fires a hook after an update as follows:

GIT_WORK_TREE=/path/to/code git checkout -f 

This works well when clicking code, for example on a web server. I can work with the code, and when I finish, updating the web server is simple. git push live master .

However, I do not know how to roll back, for example, a specific tag. This can usually be done using git checkout TAG , but when I try to check a tag (e.g. GIT_WORK_TREE=/path/to/code git checkout -f TAG ), git answers:

 error: pathspec 'TAG' did not match any file(s) known to git 

Any ideas on how to validate a tag on a remote working tree?

+2
source share
1 answer

To check the tag on the remote side, you first need to click it:

 git push --tags 

As mentioned in " With GitHub, how do I git push --all all branches when adding an existing repo? Even git push --all will not push your tags, only all refs under refs/heads/ .

+2
source

Source: https://habr.com/ru/post/972554/


All Articles