git push origin develop 什么都不做

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13390180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:55:51  来源:igfitidea点击:

git push origin develop does nothing

git

提问by John

I'm new to using git. I tried doing git push origin developand the terminal says everything is up to date. I tried git diff --stat origin/developand the terminal displays:

我是使用 git 的新手。我试过git push origin develop了,终端说一切都是最新的。我试过git diff --stat origin/develop了,终端显示:

 tpl/view/css/layout.css           |    7 ++++---
 tpl/view/ctrl.time-sheet-item.tpl |   10 +++++-----
 tpl/view/ctrl.time-sheet.tpl      |    7 +++----
 3 files changed, 12 insertions(+), 12 deletions(-)

So to me, it looks like there should still be files to push. I went to my friend's computer and did a git pull origin develop, and it didn't receive the new changes to the three files I mentioned above. How do I push my changes to the develop branch and receive them on another computer?

所以对我来说,看起来应该还有文件要推送。我去我朋友的电脑上做了一个git pull origin develop,它没有收到我上面提到的三个文件的新更改。如何将我的更改推送到开发分支并在另一台计算机上接收它们?

回答by Abraham P

Based off your comment the issue is (probably) that you branched repeatedly. (so like bar/develop, foo/bar/develop/ blah/foo/bar/develop, etc).

根据您的评论,问题(可能)是您反复分支。(比如 bar/develop、foo/bar/develop/blah/foo/bar/develop 等)。

The reason your rebase is shooting you down is that you can't rebase to a branch that doesn't contain the initial commit you branched from ( fatal: Needed a single revision)

你的变基让你失望的原因是你不能变基到一个不包含你分支的初始提交的分支(致命:需要一个修订版)

Do the following:

请执行下列操作:

 git status

This will print your current branch. (Lets assume its blah/foo/bar/develop)

这将打印您当前的分支。(让我们假设它的 blah/foo/bar/develop)

From here you have to options.

从这里你必须选择。

Option 1) Simpler, might not work if one of the intermediate steps has changed and you want things from it:

选项 1) 更简单,如果中间步骤之一发生了变化并且您想要从中获得一些东西,则可能不起作用:

 git checkout develop
 git fetch
 git rebase origin/develop
 git merge origin/blah/foo/bar/develop

Option 2) Will work but could be very timeconsuming

选项 2) 可行,但可能非常耗时

 git fetch
 git rebase origin/foo/bar/develop
 git push origin foo/bar/develop
 git checkout foo/bar/develop
 git rebase origin/bar/develop
 git push origin bar/develop
 git checkout bar/develop
 git rebase origin/develop

I would probably try option 1 and only fall back to option 2 if option 1 doesn't work In either case, solve the merge conflicts if any and you're done:

我可能会尝试选项 1,如果选项 1 不起作用,则只回退到选项 2 在任何一种情况下,解决合并冲突(如果有),你就完成了:

 git commit -a
 git push origin develop

回答by chylli

  1. you should do "git add file1 file2 ..." to add your changes
  2. you should do "git commit" to commit your changes to your local git repository
  3. then you can push what you did to the remote repository.
  1. 你应该做“git add file1 file2 ...”来添加你的更改
  2. 您应该执行“git commit”以将更改提交到本地 git 存储库
  3. 然后你可以将你所做的推送到远程存储库。