我有以下文件夹结构:
AllMyWork/
--.git/
--Proj1/
file1.cpp, ..., file10.cpp
--WindowsOnly/ (this subfolder does not exist on Linux machine)
filea.bat
--LinuxOnly/ (this subfolder does not exist on Windows machine)
fileb.sh
我在Windows机器和Linux机器上使用Proj1进行交替操作。这两台机器通过.git/和Proj1/及其内容file1.c
假设我在本地存储库中有两个分支' master‘和' new ',在master中,我决定在.gitignore中放置一个文件夹' folder /’,然后将我从存储库中取出的文件夹放到master中,添加一个新文件夹'temp/‘。现在,当我想要签出到’new‘时,我有这个
error: The following untracked working tree files would be overwritten by checkout:
.folder/subfolder/somefile
.folder/subfolder/somefile
tmp
当我运行命令git branch -a时,我看到一个与不再存在的遥控器相关联的分支列表。例如:
remotes/does-not-exist/branch1
remotes/does-not-exist/branch2
remotes/origin/dev
remotes/origin/feature3
我想从上面的列表中删除与does-not-exist关联的分支。但是,如果我运行命令git remote prune does-not-exist,我会得到以下错误
conq: repository does not exist.
fatal: Could not read from remo
我刚开始使用git,我用它来为AOKP Android ROM做贡献。我已经成功地创建了几个分支,修改了代码,并上传了在远程端合并的提交。但在我的本地存储库中,这些分支仍然显示(即使它们显示为没有更改)。问题是,当我创建这些分支时,我是直接从需要修改的子文件夹中创建的,所以我没有任何“更高”的分支可以转到。正因为如此,我不能删除那些分支-- git告诉我error: Cannot delete the branch 'MyMods' which you are currently on.
那么,我可以做些什么来摆脱这些分支呢?
我试图在不同的分支中添加一个文件夹。在我的主分支里,我有所有的文件夹。我使用以下方法创建了新分支:
git branch practice
git checkout practice
然后添加要使用的文件夹:
git add FolderName
然后我用
git commit -m 'adding new folder'
我收到这条消息是因为:
On branch practice
nothing to commit, working directory clean
所以我输入命令:
git push origin practice
主分支中的所有内容都将复制到新的分支中。