Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向所有git';用一个命令进行分支_Git_Branch_Git Branch_Git Worktree - Fatal编程技术网

向所有git';用一个命令进行分支

向所有git';用一个命令进行分支,git,branch,git-branch,git-worktree,Git,Branch,Git Branch,Git Worktree,我的计算机中有一个git repo,其中一个目录是一个git工作树,它保存文档的html构建。这棵树是这样的 . # <--- main branches here! ├── docs │   └── _build │   ├── doctrees │   ├── html # <--- gh-pages branch here! │   │   ├── _modules │   │   ├── _sources │   │   └── _st

我的计算机中有一个git repo,其中一个目录是一个git工作树,它保存文档的html构建。这棵树是这样的

. # <--- main branches here!
├── docs
│   └── _build
│       ├── doctrees
│       ├── html # <--- gh-pages branch here!
│       │   ├── _modules
│       │   ├── _sources
│       │   └── _static
│       └── latex
├── examples
└── mypackage
    ├── subpackages
    └── subpackages
或者类似的。有办法吗


干杯

不可能一次提交多个分支,也不可能合并当前未签出的分支

但是您可以稍微缩短命令。要添加所有更改并进行提交,请推入一行

git commit -am "commit message" && git push

我的项目通常有一个顶级目录,上面有“开发”内容。因此,我可能会制作一个脚本
scripts/build_doc.sh
(或您喜欢的任何语言),如下所示:

#!/bin/bash

if [ "`git status -z`" != "" ] ; then echo Need clean directory ; exit 1 ; fi

whatever_command_to_rebuild_pages

git add -A dir_to_built_html_pages && \
git commit -m "autobuild" && \
git push 

两个想法:1)您可以在提交钩子中执行此操作,2)您确定要在存储库中生成文件吗?

您似乎不了解Git中的分支是什么。路径上不存在分支。请告诉我,我知道我可以在一个目录中更改分支,并且分支不必存在于特定的目录中。我使用我所有计算机的顶级目录中的所有4个分支,除了
gh页面
,出于实际目的,我将其永久签出在
html
中,这就是我的意思。无论如何,谢谢你的书信提示。你可能会觉得有用。
#!/bin/bash

if [ "`git status -z`" != "" ] ; then echo Need clean directory ; exit 1 ; fi

whatever_command_to_rebuild_pages

git add -A dir_to_built_html_pages && \
git commit -m "autobuild" && \
git push