iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 15
0
Modern Web

用30days 了解web系列 第 15

(Day 15) git branch!

  • 分享至 

  • xImage
  •  

why we use a development branch?
https://ithelp.ithome.com.tw/upload/images/20200928/20129609C1uDUNbMc8.jpg

Let’s say you have a website that’s ready for people to see. This website is on the master branch.

If you commit code to the master branch, it means you change the website directly. If you introduce any bugs, other people can see your bug immediately.

We’re humans. We make mistakes. We don’t want to show our mistakes to people.

So we create a new branch and work off it. When we’re done, and when we’re sure that there are no more bugs (at least we try to!), we push the changes back to the master branch to update the website.

That’s why we use a development branch.

In this case, the master branch can also be called a production branch.

important option
git branch to show the available branch
git branch //branch_name to add a new branch
git checkout //branch_name to switch branch
git branch -d //branch_name to delete the branch

to merge development branch to master
before merging the branch we need to go back to master branch, by simply run
git checkout master
now you are on your master branch, and you are good to merge the develment branch into master branch by simple use merge command:
git merge development


上一篇
(day 14) Database normalization
下一篇
(day 16) Backend Engineer Roadmap
系列文
用30days 了解web30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言