Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save twlz0ne/6911858 to your computer and use it in GitHub Desktop.
Save twlz0ne/6911858 to your computer and use it in GitHub Desktop.
git feature branch 如何跟踪上游变化?

基于上游仓库某次提交做了修改

----(a)---------------> upstream/up_master
      \
------(b)-------------> origin/my_master

一段时间之后,上游仓库更新了

----(a)--(c)--(d)--(e)--(f)--(g)--> upstream/up_master

下游要怎么同步更新呢?

rebase 成这样?

----(a)--(c)--(d)--(e)--(f)--(g)--> upstream/up_master
      \       
------(b)--(c')--(d')--(e')--(f')--(g')---> origin/my_master

还是 rebase 成这样?

----(a)--(c)--(d)--(e)--(f)--(g)--> upstream/up_master
                               \              
-------------------------------(b')---> origin/my_master

合并一次?

----(a)--(c)--(d)--(e)--(f)--(g)--> upstream/up_master
      \                        \
------(b)----------------------(e)---> origin/my_master

还是合并每一次commit?

----(a)--(c)--(d)--(e)--(f)--(g)--> upstream/up_master
      \    \    \    \    \    \
------(b)--(h)--(i)--(j)---(k)--(l)---> origin/my_master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment