【发布时间】:2023-03-27 11:51:01
【问题描述】:
我遇到了一个问题,文件大小写的更改不会推送到我的远程仓库。
我尝试使用git mv 更改标题,但它不起作用。我在 GitHub 上更改了文件的名称,并将更改提交到 repo。现在我的本地仓库不会将更改推送到远程。
我不愿意将较旧的提交拉入我的本地仓库,因为我做了很多我不想丢失并且无法远程提交的更改。反正有这个吗?
cd would-you-rather
git add .
git commit -m '9th commit'
On branch main
Your branch and 'origin/main' have diverged,
and have 3 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
git push
To https://github.com/xxxx/xxx.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxx/xxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
【问题讨论】:
-
您必须在 GitHub 上将您的工作(本地)与“他们的”(您的)工作结合起来。要么,要么您可以使用
git push --force丢弃“他们的”工作(即您在 GitHub 上的工作)。但大概你想保留你的工作,以及你的工作。考虑使用git fetch,后跟git merge或git rebase。