How to create and merge branches on github | Code2night.com
Code2night
  • Home
  • Blogs
  • Tutorial
  • Post Blog
  • Members
    • Register
    • Login
  1. Home
  2. Blogpost
21 Jul
2022

How to create and merge branches on github

1050

So, for creating a new branch we have to execute checkout command with new branch name. You can provide any branch name and a new branch with that name will be created in your repository.

git checkout -b Branch Name

git checkout -b firstBranch 

So, after checkout the new branch you have switched to new branch and now we need to add files that we need to add to this branch. So we will use git add * for that purpose.

git add *

 git add *

Previous command will add up all files to your commit list but it will not commit the changes unless you use commit command that is explained below:

git commit -m "change memory streem name"

 git commit -m "change memory streem name"


Commit will commit or save your changes in local repository that are finalized to be pushed to repository.We have to always commit the changes before pushing. You can add any comment there to remember what was the commit all about. 

After commit now we have to push the changes to origin , now after origin we have to specify the branch where we want to push our changes. So in the next command we have used firstbranch which was a new branch and the commited changes will be pushed to that branch.

git push -u origin firstBranch

 git push -u origin firstBranch 

Now, for merging the new branch and existing branch we have to do this

Merging firstBranch to Master Branch


git checkout master
git pull origin firstBranch 


So this is how can add new branch and push your changes to new branch and merge branches on github.

  • |
  • Git Branching and Merging , Branching , Merging

Comments

Follow Us On Social Media - Like Us On Facebook

Tags

LinkedinLogin
LinkedinProfile
GetLinkedinProfile
C#
Aspnet
MVC
Linkedin
ITextSharp
Export to Pdf
AspNet Core
AspNet
View to Pdf in Aspnet
Model Validation In ASPNET Core MVC 60
Model Validation
Model Validation In ASPNET Core MVC
Model Validation In ASPNET
Image Compression in AspNet
Compress Image in c#
AspNet MVC
Free Download for New Subscribers!

Subscribe and Click on Verify and Download for download link

Subscribe Now | 671
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Panipat
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2023 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Terms & Conditions
  • Refund Policy
  • About Us
  • Privacy Policy
  • Json Beautifier