Comments (8)
如果你的 commit 內容很亂,常 merge 別的 branch 到你的 branch,加上別人不會 review 你的 commit,那 merge 的確夠用。
rebase 最大的用途是,整理你的 commit,讓別人容易看懂你的 commit。
it should always keep your branch on top of other branches (before send pull request).
如果你每天要幫別人 review 很多 commits,有邏輯的 commits & message,簡單的 branch,才能幫你省下很多時間。
from ama.
我覺得應該會常用到耶。
因為我時候都會做 fix typo 的 commit ,導致我的 commit message 有點亂。
比方說我有四個 commit message
Implement feature A
fix typo
fix typo
Implement feature B
可是你只是要其中兩個
Implement feature A
Implement feature B
from ama.
首先,feature/xxx
是你正在開發中的分支,base 為 commit C
master: A -> B -> C
feature/xxx: (A)->(B)->(C)-> D
有別人更新了 master
分支,且你的 feature/xxx
可能會需要因應 master
分支的更新 (commit E, F ) 修改時...
master: A -> B -> C -> E -> F
feature/xxx: (A)->(B)->(C)-> D
對 master
進行 rebase 後,可以讓 feature/xxx
的 base ( commit C) 也更新到和 master
一樣新 (commit F)
master: A -> B -> C -> E -> F
feature/xxx: (A)->(B)->(C)->(E)->(F)->D
以上,是除了 merge branch 以外,我覺得 rebase 最常用到的情境之一 :)
from ama.
認同 @puff-tw ,rebase的目的是整理,如果commits本身可以忽略,就應該要使用rebase合在一起。反之如果覺得merge訊息是必要的,那就保留merge的commit。
from ama.
這個 4 分 20 秒的影片解釋的蠻清楚的,可以參考看看:
Rebase:
- 去除、整併無謂的 Commits
😍 - 與 Source Branch 同步
⭐ - 保持乾淨歷史(貢獻開源專案)
🎈 - 可以對特定 Commit 進行修正
🙈
另可參考 Thoughtbot Git Protocol 這篇來了解為什麼開發時要 rebase
from ama.
I take the liberty to close this issue
Thanks everyone!
from ama.
@JuanitoFatas Helpful video, thanks!
from ama.
@tsechingho @puff-tw @marsz @adlerhsieh @JuanitoFatas
感謝大家的回覆,
可能我專案都是自己開發居多,忽略了共同開發時 commit 的可讀性
看完回覆之後今天自己又動手做了幾次,
已經了解為何要使用rebase了,非常謝謝大家!
from ama.
Related Issues (20)
- fork gem 後指定 gem source 為自己的 github,capistrano deploy bundle 錯誤 HOT 10
- 請教Devise的問題 HOT 1
- 實作 Agile Web Development With Rails 4 HOT 5
- Agile Web Development With Rails 4 Chapter 11.5
- Agile Web Development With Rails 4 Chapter 11.5
- ActionCable 佈署到 production 後 WebSocket connection failed HOT 4
- 如何直接取得hash的size並作運算 HOT 2
- About rails breadcrumbs gem
- Rails5 WebSocket 偶爾 handshake 404 HOT 2
- 請問關於加密的問題 HOT 2
- 面試題目參考資料 HOT 1
- 請問為何 better_errors 無法在 Rails 4.2.0 + Ruby 2.2.0 上使用? HOT 2
- 詢問 space 和 tab 轉換工具 HOT 6
- 請問要如何實做複選框+背景新增值的功能,或是有那種複選tagging的功能? HOT 11
- 為什麼 deep_dup 實作卻只是呼叫 dup HOT 1
- 請教一下,我把專案從Rails 4.2升級到 5.2,忽然Devise就無法登出了!!! HOT 5
- 請教一下,如何讓一個驗證失敗後就停住? HOT 2
- 想請教一下,如何讓事件點進去能在 Daterangepicker 顯示正確日期? HOT 3
- 商务
- Form only works after page refresh (rails 5.2.8.1, jquery 4.5.1) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ama.