Hello everyone, it’s Ray. Today I’m going to share why Git is so a lot required.
大家好我是Ray! 今天要跟大家分享,為什麼要使用Git?
Firstly, have you once encountered that situation that something comes up when you are coding, it could be that your mom calls you, or even more serious that you forget to pick up your girlfriend.
首先,你有沒有遇過,coding到一半忽然有急事要做(可能是你媽叫你,也可能是你忘記去接你女朋友)
Unfortunately, at that very moment you happens to do debugging or develop a new feature.
然而很不巧的,當時你可能正在debug,又或者在開發一個新功能。
When you finally get some free time to proceed your coding, holly shit… something goes wrong! It’s hard to debug among a sea of code especially when you don’t know where to start.
當你終於有空回去繼續coding時,靠!怎麼出錯啦~? 滿滿的程式碼滿滿的邏輯不知道從何找起從何debug起~
Or, sometimes when developing a new feature, unluckily it happens to affect the current feature and cause some error. When we realise that searching from nowhere might lack efficiency and want to go back to the moment when the new feature is not yet started, our good habit of saving file regularly just cover the light at the end of the tunnel.
又或者,有時在開發新功能時,新功能不巧地影響到現有的功能,導致現有的功能也無法使用! 當我們陷入一個無頭緒的狀態時,我們就想要回到還沒開始新功能的那一刻,很不巧的,我們早就已經養成定時存檔的良好習慣...
At this moment, we regret that we didn’t’ use git earlier.
這些時候,就是Git出場的時候啦!
When you encounter some emergency during coding, or you want to start a new feature based on current one that works, you could simply use git to save it, and after that you could go there whenever you need. Also, this kind of saving takes the precedence over the built in saving function of editors, or IDEs that you use. In other words, even though you’ve saved the file on your editor or IDE, you could still go back to the point that you saved with Git.
當你在一些關鍵的時刻,又或者已經完成一個功能,而打算從這個功能為一個起點,開始一個新功能,這個時候你可以使用Git把它存檔起來,存檔後,你可以隨時回到你存擋的那一刻,這種回朔是跟你檔案本身存擋沒有關聯的,換句話說,就算你已經在編輯器或者是IDE上面存擋了,你也可以隨時地回到你使用Git設的存擋點!
In other circumstance, except for the small project that you could complete on your own, it required multi-collaboration when it comes to a big project. Have you thought of how to efficiently collaborate with each other? After all, coding is sort of delicate work. One typo sometimes could keep the function from working properly.
另外一個情況,除非你做的是一個人可以完成的小專案,否則只要是多人協作的專案都需要多人合作與配合,有沒有想過,當這麼多人來一起做一個案子甚至一個檔案,該如何有效地整合呢?畢竟coding是非常細緻的工作,就算你只錯了一個字也可以會造成整個功能無法使用啊!
At this circumstance we always use Git to do the integration. Imaging that you do your portion on your own computer, and upload to a mutual folder after you finish it. Other team member do the same thing, and Git could do the integration.
這個時候通常我們都會使用Git來整合,試想你的電腦上是一個你自己擁有的資料夾,當你在你的電腦上把你的部分完成之後,你把完成的部分上傳到一個公共的資料夾,而團隊內的其他成員也是用這種方式來上傳他們的部分,此時Git可以讓我們記錄所有人的部分並且將所有人的code合併已達到整合!
So to a coder, Git seems to be an integral tool.
所以對於一個coder來說,Git似乎是不可或缺的呢!