DEV Community

milan1750
milan1750

Posted on

Creating and Merging New Branch on GIT

List Branch

$git branch

  • master

Add new Branch

$git branch new-branch

List Branch

$git branch

  • master

new-branch

Master is your current branch. Lets jump to new-branch

Checking out to new-branch

$git checkout new-branch

List Branch

$git branch
master
*new-branch

Now you are in New-Branch. Lets quickly create a file
$nano myfile.txt //Wtite some stuff, Save with (Ctrl+S) and exit (Ctrl+z)

Add to the git
$git add myfile.txt
$git commit -am "myfile added"
$git push origin new-branch

Merge to Master
$git checkout master
$git add -A
$git merge new-branch
$git commit -am "Merged"
$git push origin master

Good Luck

Top comments (0)