git bash 分支冲突
git bash branches conflict
我是 git bash 的新手。我以前只使用该网站将我的项目上传到我的 git 在线中心页面。
我需要使用 git bash 才能上传更大的文件。我成功上传了一些文件,
而且我不确定我是否应该以某种方式“关闭”分支或删除它。
以我有限的知识,
我重新打开 git 以便稍后添加更多文件,并使用命令
git init
再一次,
但现在我无法推送我的文件。
我认为它创建了多个分支。当我尝试推送时,我得到:
"Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. git pull) before pushing again."
当我尝试 git pull 时出现以下错误:
"fatal: refusing to merge unrelated history",
或
git pull origin master --allow-unrelated-histories
我得到:
"Encountered 1 files that should have been pointers. but weren't. Automatic merge failed. Fix conflicts and then commit the result."
我想我还添加了一个我之前没有提交的文件。
我认为这个文件使用 LFS(大文件存储),因为正如我所说,我想上传大文件。通过使用 git lfs track "*.file-type"
它正在使用指针跟踪文件。
当我重试这里是输出
"your branch and 'origin/master' have diverged"
我错过了什么?我该怎么办?
已解决!当它说一个文件不是一个指针但应该是一个指针时,这意味着为这种类型的文件启用了 lfs 跟踪,但是这个文件没有被正确跟踪。可能是在添加此文件后启用了对此类文件的 lfs 跟踪,但未提交该文件。在这种情况下,您需要使用 git lfs track name-of-file.extension-of-file
手动跟踪它。在此之后,如果它不允许您合并,您需要添加冲突的两个分支中丢失或被修改的所有文件。 git add .
为您添加丢失的文件,但您的目录中也必须有它们。然后 git commit -m "removed conflict"
和 git push
。仅此而已。
我是 git bash 的新手。我以前只使用该网站将我的项目上传到我的 git 在线中心页面。
我需要使用 git bash 才能上传更大的文件。我成功上传了一些文件, 而且我不确定我是否应该以某种方式“关闭”分支或删除它。
以我有限的知识,
我重新打开 git 以便稍后添加更多文件,并使用命令
git init
再一次,
但现在我无法推送我的文件。
我认为它创建了多个分支。当我尝试推送时,我得到:
"Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. git pull) before pushing again."
当我尝试 git pull 时出现以下错误:
"fatal: refusing to merge unrelated history",
或
git pull origin master --allow-unrelated-histories
我得到:
"Encountered 1 files that should have been pointers. but weren't. Automatic merge failed. Fix conflicts and then commit the result."
我想我还添加了一个我之前没有提交的文件。
我认为这个文件使用 LFS(大文件存储),因为正如我所说,我想上传大文件。通过使用 git lfs track "*.file-type"
它正在使用指针跟踪文件。
当我重试这里是输出
"your branch and 'origin/master' have diverged"
我错过了什么?我该怎么办?
已解决!当它说一个文件不是一个指针但应该是一个指针时,这意味着为这种类型的文件启用了 lfs 跟踪,但是这个文件没有被正确跟踪。可能是在添加此文件后启用了对此类文件的 lfs 跟踪,但未提交该文件。在这种情况下,您需要使用 git lfs track name-of-file.extension-of-file
手动跟踪它。在此之后,如果它不允许您合并,您需要添加冲突的两个分支中丢失或被修改的所有文件。 git add .
为您添加丢失的文件,但您的目录中也必须有它们。然后 git commit -m "removed conflict"
和 git push
。仅此而已。