DEV Community


Creating and Merging New Branch on GIT

milan1750 profile image milan1750 ・1 min read

List Branch

$git branch

  • master

Add new Branch

$git branch new-branch

List Branch

$git branch

  • master


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

Checking out to new-branch

$git checkout new-branch

List Branch

$git 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

Discussion (0)

Forem Open with the Forem app