假设我的设置看起来很像
phd/code/
phd/figures/
phd/thesis/
Run Code Online (Sandbox Code Playgroud)
由于历史原因,这些都有自己的git存储库.但我想将它们合并为一个,以简化一些事情.例如,现在我可能会进行两组更改,并且必须执行类似的操作
cd phd/code
git commit
cd ../figures
git commit
Run Code Online (Sandbox Code Playgroud)
表演(现在)很棒
cd phd
git commit
Run Code Online (Sandbox Code Playgroud)
似乎有几种方法可以使用子模块或从我的子存储库中提取,但这比我正在寻找的要复杂一些.至少,我很高兴
cd phd
git init
git add [[everything that's already in my other repositories]]
Run Code Online (Sandbox Code Playgroud)
但这似乎不是一个单行.有什么git可以帮助我吗?
"Cannot rewrite branch(es) with a dirty working directory".
我是Git的新手 - 我试着谷歌搜索无济于事的答案.
这个错误是什么意思?我该怎么办?
我想根据git 文档从 git 历史记录中删除一些文件/文件夹,但由于unstaged changes. 我不清楚可能会有哪些未分阶段的更改,就像我 git add --all之前所做的那样,提交并推送。somefolder/请注意, HEAD 中不再存在要删除的文件夹。它已在早期提交中移动,但旧版本需要从存储库中清除。
~$ git add --all
~$ git commit -m "trying to fix 'Cannot rewrite branches: You have unstaged changes'"
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
~$ git push
Everything up-to-date
~$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
~$ git …Run Code Online (Sandbox Code Playgroud) git ×3