最近偶而會參與一些 github 上的專案,上面有一些小 bug 或是要新增一些東西,簡單幾個步驟就可以做得到。
但是當我7天前把一個repo給 fork 回來,它其實是不會自動更新的。
要用下面幾個步驟來進行更新。
其本上下面的程式碼貼完就可以了,詳見:
http://stackoverflow.com/questions/7244321/how-to-update-github-forked-repository
# Add the remote, call it "upstream":
git remote add upstream git://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
git checkout master
# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:
git rebase upstream/master
git push -f origin master