本文介绍了Git推动不会做任何事(一切都是最新的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我试图在github上更新git仓库。我做了一堆更改,添加了它们,然后尝试做一个git push。回应告诉我,一切都是最新的,但显然不是。 git remote show origin 用我期望的存储库进行响应。 为什么git告诉我存储库是最新的,当存在本地提交时,在仓库中可见? [searchgraph] git status #分支开发#未追踪文件:#(使用git add< file> ...来包含将要提交的内容)##Capfile #config / deploy.rb 没有添加提交但未跟踪的文件存在(使用git add跟踪) [searchgraph] git add。 $ b $ [searchgraph] git status #分支开发#要提交的更改:#(使用git reset HEAD< file> ...取消)##新文件:Capfile #新文件:config / deploy.rb # [searchgraph] git commit -m 添加了Capistrano部署 [develop 12e8af7]添加了Capistrano部署 2个文件已更改,26个插入(+),0个删除( - )创建模式100644 Capfile 创建模式100644 config / deploy.rb [searchgraph] git push 所有最新的 [searchgraph] git status #分支开发没有提交(工作目录干净) 解决方案 git push 不会推送所有本地分支:它如何知道将哪些分支推送给他们?它仅推送已配置为推送到特定远程分支的本地分支。 在我的git版本(1.6.5.3)中,当我运行 本地参考配置为'git push': master推到master(最新) quux推到quux(快速转发) Q。但是我可以推到 master ,而不用担心这一切! 当 git clone ,默认情况下它会设置你的本地 master 分支来推送到远程的 master branch(本地称为 origin / master ),所以如果你只提交 master ,那么一个简单的 git push 会一直推回你的修改。然而,从你发布的输出片段看,你是在一个名为 develop 的分支上,我猜测这个分支还没有被设置为任何东西。因此,不带参数的 git push 不会推送该分支上的提交。 当它显示Everything up-to日期,意思是你告诉我所有的分支都是最新的。所以我怎么能推我的提交? 如果你想要做的是从 develop 转换为 origin / master ,那么你应该将它们合并到你的本地 master 中,然后按下: git checkout master git merge develop git push#会推送'master' 如果你想要在远程创建一个 develop 分支,从 master ,然后将参数提供给 git push : git push origin develop 这将会:创建一个新的分支在远程调用 develop ; 和使该分支与本地的 develop 分支保持同步; set develop 推到 origin / develop ,以便将来 git push 不带参数 会自动推送开发。 如果您想将本地开发推送到名为 以外的远程分支 开发,那么你可以说: git push origin develop:something-else 然而, 不会设置开发在将来总是推送到 origin / something-else ;这是一次性操作。 I'm trying to update a git repository on github. I made a bunch of changes, added them, committed then attempted to do a git push. The response tells me that everything is up to date, but clearly it's not. git remote show originresponds with the repository I'd expect.Why is git telling me the repository is up to date when there are local commits that aren't visible on the repository? [searchgraph] git status# On branch develop# Untracked files:# (use "git add <file>..." to include in what will be committed)## Capfile# config/deploy.rbnothing added to commit but untracked files present (use "git add" to track) [searchgraph] git add . [searchgraph] git status# On branch develop# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## new file: Capfile# new file: config/deploy.rb# [searchgraph] git commit -m "Added Capistrano deployment"[develop 12e8af7] Added Capistrano deployment 2 files changed, 26 insertions(+), 0 deletions(-) create mode 100644 Capfile create mode 100644 config/deploy.rb [searchgraph] git pushEverything up-to-date [searchgraph] git status# On branch developnothing to commit (working directory clean) 解决方案 git push doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.On my version of git (1.6.5.3), when I run git remote show origin it actually prints out which branches are configured for push:Local refs configured for 'git push': master pushes to master (up to date) quux pushes to quux (fast forwardable)Q. But I could push to master without worrying about all this!When you git clone, by default it sets up your local master branch to push to the remote's master branch (locally referred to as origin/master), so if you only commit on master, then a simple git push will always push your changes back.However, from the output snippet you posted, you're on a branch called develop, which I'm guessing hasn't been set up to push to anything. So git push without arguments won't push commits on that branch.When it says "Everything up-to-date", it means "all the branches you've told me how to push are up to date".Q. So how can I push my commits?If what you want to do is put your changes from develop into origin/master, then you should probably merge them into your local master then push that:git checkout mastergit merge developgit push # will push 'master'If what you want is to create a develop branch on the remote, separate from master, then supply arguments to git push:git push origin developThat will: create a new branch on the remote called develop; and bring that branch up to date with your local develop branch; and set develop to push to origin/develop so that in future, git push without arguments will push develop automatically.If you want to push your local develop to a remote branch called something other than develop, then you can say:git push origin develop:something-elseHowever, that form won't set up develop to always push to origin/something-else in future; it's a one-shot operation. 这篇关于Git推动不会做任何事(一切都是最新的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-06 16:42