这怎么可能?
这是我的本地文件夹
还有我的远程文件夹。 (他们是同一个分支)
我在另一个分支中更改了文件夹名称,我只是不明白它如何影响我当前的分支。而且我还没有从对当前分支进行文件夹名称更改的分支中拉取。因此,它导致构建错误..
它正在影响除实际更改的分支之外的所有其他分支:(
远程分支很好,只是它导致了不必要的构建错误,而且我将来无法看到实际的错误
我该如何解决这个问题?
Git 可以配置为区分大小写或不区分大小写。 看起来你的情况下 git 配置为不区分大小写
TL;博士;
# Change the case flag to false so that git will trach the changes
git config core.ignorecase false
长演示,以及如何修复它:
#!/bin/bash
# Clear any exsiting code
rm -rf /tmp/remoteRepository
rm -rf /tmp/localRepository
### Create the dummy repository
git init --bare /tmp/remoteRepository
### Clone the repository
git clone /tmp/remoteRepository /tmp/localRepository
### Switch to the new working directory
cd /tmp/localRepository
###
### Setup the ignorecase flag for the repository
###
git config core.ignorecase true
## Create come content
mkdir -p AAA-folder
echo 'text' > AAA-folder/AAA-file.txt
### Commit the changes
git add AAA-folder/AAA-file.txt
git commit -m "Added AAA-file.txt"
### Push the changes to the remote repository
git push origin main
### Lets now change the folder name
mv AAA-folder aaa-folder
## Let check the staging area for changes
##
## >>> No changes !!!
git status
## List local files and directories
echo "----------------------------------------------------"
echo "Local files:"
echo ""
ls | grep *-folder
## List local files as they are "stored" in git
echo "----------------------------------------------------"
echo "Local git file names:"
echo ""
git ls-tree main --name-only
## List remotes file and folders
echo "----------------------------------------------------"
echo "Remote files:"
echo ""
git ls-tree -r origin/main --name-only
# Change the case flag to false so that git will trach the changes
git config core.ignorecase false
# Verify that now we see the changes
echo "----------------------------------------------------"
git status