是否可以仅将子目录的更改从本地git分支合并到远程git分支,还是"全有或全无"?
例如,我有:
branch-a
- content-1
- dir-1
- content-2
Run Code Online (Sandbox Code Playgroud)
和
branch-b
- content-1
- dir-1
- `content-2
Run Code Online (Sandbox Code Playgroud)
我只想将branch-a dir-1的内容与branch-b dir-1的内容合并.
如果远程存储库中有标签,我通常会在拉动时自动获取它们.当我删除创建的本地标记(git tag -d <tag-name>)并拉动时,将重新创建已删除的标记.我可以删除远程分支/标签(git push <remote-branch/tag-name>:<branch/tag-name>),但是如何通过获取远程标签来检测本地标签是否已创建?
我已经设置了我的环境,所以我可以推送到远程裸存储库,我使用这些命令来设置远程存储库:
$ mkdir ~/website.git && cd ~/website.git
$ git init --bare
Run Code Online (Sandbox Code Playgroud)
和
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/website git checkout -f
$ chmod +x hooks/post-receive
Run Code Online (Sandbox Code Playgroud)
在我的本地环境中:
$ git remote add web ssh://website.com/home/website.git
$ git push web +master:refs/heads/master
Run Code Online (Sandbox Code Playgroud)
现在我可以部署到这个远程使用git push web,一切都很好..
我的项目中有一些子模块没有在远程存储库中初始化/更新...我无法git submodule update在裸机上运行,因为它是裸的,我不能在/var/www/website文件夹上运行它,因为它只是一个副本的文件而不是git repo.
在更新后的挂钩中使用以下代码时是否可以包含子模块?
GIT_WORK_TREE=/path/to/directory git checkout -f
Run Code Online (Sandbox Code Playgroud)
我还有什么其他选择来分发代码,包括更新后挂钩的子模块?
谢谢.