Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果老師有更新檔案,本機端該如何同步檔案呢? #12

Open
istar0me opened this issue Nov 8, 2017 · 1 comment
Open

Comments

@istar0me
Copy link

istar0me commented Nov 8, 2017

分成三種狀況:

一、最簡單卻不建議的方法

  • 刪除原先的檔案,再 clone (複製)檔案下來本機端
git clone https://github.com/istar0me/wp106a.git

二、如果當初 clone 下來的是 fork 老師的版本

  1. 把檔案 pull 下來,會自動合併
git pull

三、如果當初 clone 下來的是 fork 後的 repository (不是老師的)

  1. 顯示目前所有的遠端目錄
git remote -v
  • 應該可看見
origin  https://github.com/istar0me/wp106a.git (fetch)
origin  https://github.com/istar0me/wp106a.git (push)
  1. 新增遠端 Repository (老師版本)
git remote add cccnquWp106a https://github.com/cccnqu/wp106a.git
  1. 此時確認目前追蹤的遠端清單
git remote -v
  • 會發現多出兩組 upstream
cccnquWp106a    https://github.com/cccnqu/wp106a.git (fetch)
cccnquWp106a    https://github.com/cccnqu/wp106a.git (push)
  1. 切換到要做更新的分支
git checkout <branch_name>
  • 一般 branch_name 為 master
  1. 將老師新版本的檔案拉進自己 master 分支
git pull cccnquWp106a master
  1. 完成本機端的更新,此時可選擇將新版的檔案上傳到自己的 GitHub 上
git push origin master
@agron911
Copy link

agron911 commented Nov 8, 2017

讚喔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants