我可以做什么来解决“1在主人后面犯下的事情”? [英] What I can do to resolve "1 commit behind master"?

查看:209
本文介绍了我可以做什么来解决“1在主人后面犯下的事情”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


1在master后面提交。

这个合并的冲突必须先解析
,然后才能提交。



要手动将这些更改合并到TA20footerLast中,请运行以下命令:

> git checkout 7c891f50c557



注意:这会创建一个分离的头!



> git merge remotes / origin / master



解决方案

我知道这是迟到了,但它可以帮助其他人。



在开始之前,如果您对命令行感到不适,您可以使用 SourceTree GitExtension 执行以下所有步骤, GitHub桌面或您最喜爱的工具。只需按照以下步骤操作即可:

要解决此问题,您可能需要两个场景

<例如:两个分支都在远程端

$ b $

b

头部===主分支



后面===开发分支



解决方案:

将资源库克隆到本地工作区:这会为您提供主分支的主分支

  git clone repositoryUrl 



  git checkout -b DevelopBranchName //这个命令创建并签出分支

iii)从远程开发分支中提取

  git pull origin DevelopBranchName 

iv )合并当地的发展胸罩nch与远程开发分支

  git merge origin开发

v)将合并的分支推送到远程的Develop分支

  git push原产地开发

2)本地主分支在远程主分支之后



这意味着每个本地创建的分支都在后面。

供参考之前:必须提交或隐藏所有更改您在提交后的分支上所做的更改。



解决方案: i)签出您当地的主分行

  git checkout master 

ii)从远程主分支中提取

  git pull origin master 

现在您的本地主控与远程分支同步,但其他本地远程控制与本地主控不同步由于上述公司的分支mmand。要解决这个问题:

1)签出本地主分支后面的分支

  git checkout BranchNameBehindCommit 



<2>与本地主分支合并

  git merge master //现在你的分支与本地主分支同步

如果此分支位于远程存储库中,则必须进行推送

  git push origin branchBehindCommit 


After pushing I've been seeing this message at remote repository:

1 commit behind master.

This merge has conflicts that must be resolved before it can be committed.

To manually merge these changes into TA20footerLast run the following commands:

> git checkout 7c891f50c557

#Note: This will create a detached head!

> git merge remotes/origin/master

解决方案

I know this is late Answer but it could help others.

Before you begin, if you are uncomfortable with a command line, you can do all the following steps using SourceTree, GitExtension, GitHub Desktop or your favorite tool. Just follow the steps:

To solve the problem you might have Two Scenarios:

1) Fix only remote repository branch which is behind commit

Example: Both branch are on remote side

a head === Master branch

behind === Develop branch

Solution:

i) Clone the repository to local workspace: this will give you the Master branch which is a head with commit

    git clone repositoryUrl

ii) Create a branch with Develop name and checkout to that branch locally

   git checkout -b DevelopBranchName // this command creates and checkout the branch

iii) Pull from the remote Develop branch

   git pull origin DevelopBranchName

iv) Merge the local Develop branch with the remote Develop branch

     git merge origin develop 

v) Push the merged branch to the remote Develop branch

     git push origin develop

2) Local Master branch is behind the remote Master branch

This means every locally created branch are behind.

FYI: Before preceding, you have to commit or stash all changes you made on the branch that is behind commits.

Solution:

i) Checkout your local Master branch

   git checkout master

ii) Pull from remote Master branch

   git pull origin master

Now your local Master is in sync with the remote Branch but other local remotes are not in sync with your local Master branch because of the above command. To fix that:

1) Checkout the branch that is behind your local Master branch

    git checkout BranchNameBehindCommit

2) Merge with the local Master branch

    git merge master  // Now you branch is in sync with local Master branch

If this branch is on remote repository, you have to make a push

     git push origin branchBehindCommit

这篇关于我可以做什么来解决“1在主人后面犯下的事情”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆