- Forums
- Scripts
- The Easiest Way To Create A New Branch In Git Bash
this is by far the easiest tutorial you will find about how to create a new branch in git bash [8953], Last Updated: Sat May 18, 2024
giter
Wed Dec 09, 2015
0 Comments
123 Visits
i am new to git, so i am creating these notes to help me remember how to use the branch command in git.
branches are very helpful if you dont want to do major changes to your code or project. i often use it just to test a new feature to see how it goes.
shows the current branch
git branch
to create a new branch:
git branch Branch_Name
to change to a different branch
git checkout Branch_Name
as you can see, its very simple, here is the video that helped me understand about branch command in git.
https://www.youtube.com/watch?time_continue=37&v=b6GMwT35I38
you can use this command to to help you visuallize the branch structure using this command:
git log --graph --oneline master New_Repository
more info at: https://www.youtube.com/watch?time_continue=155&v=aG2Bx9WsMXY
if you want to create a new branch to retain commits you created you may do so (now or later) by using -b with the check commit again. example:
git checkout -b new_branch_name
check out the video, it explain it all in great detail
https://www.youtube.com/watch?time_continue=7&v=NOy4opLU6os
IMPORTANT: before you run that merge command, need to make sure you have the master checked out
git checkout master
now the next step once you have created your branches, you can merge the branches together, just follow this tutorial:
https://www.youtube.com/watch?v=xsJzPSksa4g
to merge two branches together run the merge command
git merge master New_branch
to delete a branch you can just run this command;
git branch -d Branch_name