git

[Git] Git Branching

Everything is local

Posted by Yu-Hsuan Yen on 2017-03-27

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Branch Concept

This is the most import part of git, cause you do all things at Github is based on this toturial.
Okay, let’s begin ^_^.
First, assume that you’re working on your project and have some commits already.
commit-history
You find out there is an issue on your project, so you create a branch and switch to it.

1
2
$ git checkout -b iss66
Switched to a new branch "iss66"

create issu66
then you solve the bug and commite it.

1
$ git commit -m "fix [issue66]"

fixed issu66
Final step, after you fixed the problem you want to merge the iss66 and master.

1
2
$ git checkout master # change HEAD back to master to do the merge
$ git merge iss66

merge

Summary

Here is the whole workflow :

1
2
3
4
$ git checkout -b "<branch name>"  # create new branch and change HEAD to it
$ git commit -m "<commit message>" # commit to the new branch
$ git checkout master # change HEAD back to master
$ git merge <branch name> # merge the specific branch into master

Good Job ^_^

YAAA, you are good to go!
There still have a lot to learn, this series of git tutorial is for the very beginner.
Hope you guys like it ~
Peace!

Let’s go to the other git tutorial:
Prev - Git Basics

Full series of git tutorial