简体   繁体   English

Git:将远程分支拉到本地

[英]Git: pull remote branch to local

I am new to git. 我是git的新手。

I have an issue where I get this message when I checked out a local branch: 我有一个问题,当我签出本地分支时会收到此消息:

Your branch and 'origin/master' have diverged,
and have 5 and 4 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

My concern is if I pull changes from the remote and merge it to my local branch will it affect any of my changes I have made in my local? 我担心的是,如果我从远程提取更改并将其合并到本地分支,这会影响我在本地所做的任何更改吗?

I have been reading around and the closest is probably this but it did not answer my concern. 我一直在阅读,最接近的可能是这个,但是它并没有回答我的担忧。

Hi you can create a new branch from your current branch with: 嗨,您可以使用以下方法从当前分支创建一个新分支:

git branch my_changes

later you can pull the branch,(for example master) now if the merge generate a conflict you can resolve them, but only your real change is in branch "my_changes" 稍后您可以拉分支(例如master),如果合并产生冲突,您可以解决它们,但是只有真正的更改在分支“ my_changes”中

if you want switch your change branch you can type 如果要切换更改分支,可以键入

git checkout my_changes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM