把 local 的 branch push 到 remote 後, 通常也會同步設定將 local 的 branch 的 upstream 設成 remote branch. 這樣之後 fetch/pull 時就會自動更新. 以下紀錄作法.
git push -u REMOTE_NAME LOCAL_BRANCH_NAME[:REMOTE_BRANCH_NAME]
git push REMOTE_NAME LOCAL_BRANCH_NAME
git branch --set-upstream-to=REMOTE_NAME/REMOTE_BRANCH_NAME LOCAL_BRANCH_NAME
當 upstream 已經設定後, 可以透過已下兩種方式 push 到 remote
git checkout BRANCH_NAME
git push
git push REMOTE_NAME BRANCH_NAME
git config branch.BRANCH_NAME.mergeOptions --ff-only
如此, 在 .git/config 可以看到
[branch "BRANCH_NAME"]
mergeOptions = --ff-only
git config --global pull.rebase true
git fetch origin
git rebase −p REMOTE_NANE/REMOTE_BRANCH_NAME
Git
Written on
March
28th,
2022
by
Borting