“git 状态”显示要提交的更改,但是“git push origin master”说“一切都是最新的”

发布于 2024-09-06 14:23:06 字数 316 浏览 7 评论 0原文

我的本地仓库和远程仓库之间存在一些冲突。

所以,我做了:

git stash
git pull origin master
git stash apply

// here i had merge conflicts, so i edited the files and did
git add file1
git add file2

git commit

现在,当我执行 git status 时,它会显示一堆修改过的文件等。 但是 git push origin master 说一切都是最新的。

有什么想法吗?

I had some conflicts between my local repo and the remote repo.

So, I did:

git stash
git pull origin master
git stash apply

// here i had merge conflicts, so i edited the files and did
git add file1
git add file2

git commit

Now when I do git status it shows a bunch of modified files, etc.
But git push origin master says Everything up-to-date.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

三岁铭 2024-09-13 14:23:06

如果 git status 显示已修改的文件,则这些文件不会被推送,因为它们尚未提交。 git status 仅显示尚未提交的更改(即使它们已暂存)。

再次尝试commit,看看commit的时候是否有错误信息。 (您可能还需要git add没有有合并冲突的文件,如果它们受到您从存储中弹出的任何内容的影响 - 存储不会保存阶段状态.)

If git status is showing modified files, those aren't going to be pushed because they're not committed yet. git status only shows changes that haven't yet been committed (even if they have been staged).

Try committing again and see if there are any error messages when you go to commit. (You may also need to git add files that didn't have merge conflicts, if they were affected by whatever your popped from your stash - stashing doesn't save stage state.)

那片花海 2024-09-13 14:23:06

你的提交真的成功了吗?如果您在拉取后确实进行了提交,那么推回到原点就必须推送该提交。听起来你还没有。 git status 仍然显示修改过的文件这一事实是您还没有这样做的另一个迹象 - 理想情况下,您在提交后最终会得到一个干净的树; git status 将显示“没有任何可提交的内容”。如果它们仍然显示为已修改,则它们尚未提交。

Did your commit actually succeed? If you had indeed made a commit since you pulled, pushing back to origin would have to push that commit. It sounds like you haven't. The fact that git status shows modified files still is another sign that you haven't - ideally, you'd end up with a clean tree after commmitting; git status would show "nothing to commit". If they're still showing up as modified, they haven't been committed yet.

樱娆 2024-09-13 14:23:06

两件事:

  1. 首先,你完成了“git add”吗?和“git commit -a”,只是为了确保您实际上已经获得了所有内容并添加了所有内容?
  2. 您可能希望尝试切换 autocrlf - 'git config core.autocrlf true'、'git config core.autocrlf false' 等等,在每个之间执行“git status”。我一直遇到这个问题。

Two things:

  1. First, have you done 'git add .' and 'git commit -a', just to be sure you've actually gotten everything and added everything?
  2. You may wish to try switching your autocrlf - 'git config core.autocrlf true', 'git config core.autocrlf false' and so on, doing a 'git status' in between each one. I run into this problem all the time.
纸伞微斜 2024-09-13 14:23:06

这可能是不言而喻的,但为了明确起见,请确保您的本地分支是“master”。当您运行 git status 时,查看您所在的分支。例如,如果您创建了一个名为“foo”的分支并且当前位于该分支上,则必须运行以下命令将当前的“foo”分支推送到远程“master”分支:

git push origin foo:master

This might go without saying, but just to be explicit, make sure your local branch is 'master'. When you run git status look to see which branch you're on. If, for example, you created a branch called 'foo' and are currently on that branch you'll have to run this command to push your current 'foo' branch to the remote 'master' branch:

git push origin foo:master
无声情话 2024-09-13 14:23:06

您可以先执行 git commit -a -m "any message after change file"

然后执行 git push origin master ,然后您的更改也将反映在远程存储库中。

You can do first git commit -a -m "any message after change file"

Then do git push origin master and then your changes will reflect in remote repo too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文