在本地和GitHub上合并分支

This is a basic newbie question about Git and GitHub. I just want to make sure I'm doing it right.

I have a local Git as well as a GitHub repo for my ReactNative project. I have Master and Develop branches and in order to test out native-base UI library, I created a new branch named NativeBase. I now want to merge the NativeBase branch back into Develop both locally and on GitHub.

以下是正确的步骤吗?

  1. I make sure I'm on Develop branch by issuing git checkout develop in my terminal
  2. Then issuing git merge nativebase will merge the NativeBase into Develop
  3. I think the next step is to get the updated Develop onto GitHub by issuing git push -u origin develop

One thing I'm not clear about is what happens to the NativeBase branch on GitHub. I think Step 2 here will remove the NativeBase branch locally because it's now merged into Develop. Is that correct?

Also, is this how I need to update/merge GitHub repos after a merge locally?

评论
仵灵波
仵灵波
我认为此处的步骤2将在本地删除NativeBase分支,因为   现在已合并到Develop中

This is not true although all the info and history of the branch are now in the Develop branch. You have to delete the NativeBase branch.

git branch -d NativeBase

-d is safe and recommended because it will make sure that all the commits from NativeBase are moved to the Develop branch before deletion.

GitHub上的NativeBase分支发生了什么

除非您明确地做某事,否则什么也不会做。如果您还希望删除GitHub上的分支,则必须强制删除它。

git push origin --delete NativeBase
点赞
评论