Merging Branch Locally and on GitHub

Viewed 130

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.

Are the following the correct steps to do this?

  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?

1 Answers

I think Step 2 here will remove the NativeBase branch locally because it's now merged into 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.

what happens to the NativeBase branch on GitHub

Nothing unless you do something explicitly. You have to delete it on the remote host.

git push origin --delete NativeBase
Related