[英]Current branch is behind its remote counterpart
I'm really new to git, we have a simple project with a single branch, but at some point I decided to delete my local project folder and created a new one.我对 git 真的很陌生,我们有一个带有单个分支的简单项目,但在某些时候我决定删除我的本地项目文件夹并创建一个新文件夹。 Now I want to push it to that single branch, and it tells me the tip of current branch is behind its remote counterpart?
现在我想把它推送到那个单一的分支,它告诉我当前分支的尖端在它的远程分支后面? What should I do?
我应该怎么办? I needed to write the project a new and want to clear the branch as if it was created a new on the remote
我需要编写一个新项目并想清除分支,就好像它是在遥控器上创建的一样
“the tip of your current branch is behind its remote counterpart”
“您当前分支的尖端位于其远程分支的后面”
...means that there have been changes on the remote branch that you don't have locally. ...意味着远程分支上发生了您在本地没有的更改。
As an example, let's say that you have created a local branch named my-feature
.例如,假设您创建了一个名为
my-feature
的本地分支。
$ git branch
master
* my-feature
feature
However, you want to push your changes to the remote branch named “feature” on your repository.但是,您希望将更改推送到存储库上名为“feature”的远程分支。
In order to push your branch to another branch, you may need to merge the remote branch to your current local branch.为了将您的分支推送到另一个分支,您可能需要将远程分支合并到您当前的本地分支。
In order to be merged, the tip of the remote branch cannot be behind the branch you are trying to push.为了合并,远程分支的尖端不能位于您尝试推送的分支之后。
Before pushing, make sure to pull the changes from the remote branch and integrate them with your current local branch.在推送之前,请确保从远程分支中提取更改并将它们与您当前的本地分支集成。
In order to push your branch ( my-feature
) to the feature
branch, you would execute the following command:为了将您的分支(
my-feature
)推送到feature
分支,您将执行以下命令:
$ git pull
$ git checkout my-feature
$ git merge origin/feature
$ git push origin my-feature:feature
Note: when merging the remote branch, you are merging your local branch with the upstream branch of your local repository.
注意:合并远程分支时,您将本地分支与本地存储库的上游分支合并。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.