“git 状态”显示要提交的更改,但是“git push origin master”说“一切都是最新的”
我的本地仓库和远程仓库之间存在一些冲突。
所以,我做了:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果 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.)你的提交真的成功了吗?如果您在拉取后确实进行了提交,那么推回到原点就必须推送该提交。听起来你还没有。
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.两件事:
Two things:
这可能是不言而喻的,但为了明确起见,请确保您的本地分支是“master”。当您运行 git status 时,查看您所在的分支。例如,如果您创建了一个名为“foo”的分支并且当前位于该分支上,则必须运行以下命令将当前的“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
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.