📁
EdmundHee
  • Edmund's How to
  • Python
    • Virtual Environment
      • Setup for Windows
      • Setup for Mac
      • How to use VirtualEnvWrapper
  • Git
    • Setup Git Environment
      • Setup Git for Windows
      • Setup Git for Mac
    • Github's How-to
      • Create a repository
      • Repository Branch
      • Update Repository
  • AWS
    • EC2
      • [Raw] EC2 - Recovery Instance
  • Web Development
    • NodeJS
Powered by GitBook
On this page
  • Create Branch
  • Merge Branch
  • Remove Branch

Was this helpful?

  1. Git
  2. Github's How-to

Repository Branch

Create Branch

When cloud repository is created, master branch will be initialised by default. We are able to create different branch with the following command

git branch -b <New Branch Name>

Once the branch had been created in your local workstation, Github Repository won't have any record on the branch. In order to create a new branch in the cloud repository, run the following command,

git push orign <New Branch Name>

Merge Branch

After we had completed the development in a specific branch, we could merge two different branch.

Given a scenario, we want to merge feature/login branch to develop branch, and currently we are in feature/login branch. Run the following code to change to develop branch and merge the branch.

git checkout develop
git merge feature/login

After merging the code, we will need to push the code to cloud repository with the following command

git push origin develop

Remove Branch

After merging branch, we could remove the branch in local with the following command

git branch -d feature/login

feature/login branch will be removed in local machine, but feature/login still exist in cloud repository. Run the following command to remove the cloud branch

git push origin :feature/login

Now, we know how to create a new branch, merging branch and remove branch

PreviousCreate a repositoryNextUpdate Repository

Last updated 5 years ago

Was this helpful?