git push 新手

  1. C:\Users\1903\Downloads\My code\folder>test.py

  2. C:\Users\1903\Downloads\My code\folder>git commit -m "v 2.0"
  3. [master xxxxxxx] v 2.0
  4. 1 file changed, 30 insertions(+), 27 deletions(-)
  5. rewrite test.py (69%)

  6. C:\Users\1903\Downloads\My code\folder>git push -u origin master
  7. To https://github.com/xxxxxx/try-and-error-20200914.git
  8. ! [rejected]        master -> master (fetch first)
  9. error: failed to push some refs to 'https://github.com/xxxxxx/test.git'
  10. hint: Updates were rejected because the remote contains work that you do
  11. hint: not have locally. This is usually caused by another repository pushing
  12. hint: to the same ref. You may want to first integrate the remote changes
  13. hint: (e.g., 'git pull ...') before pushing again.
  14. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

  15. C:\Users\1903\Downloads\My code\folder>
複製代碼
我想更新 github 的 py 檔,唔知做錯咩
  1. git add test.py
複製代碼
  1. git commit -m "v 2.0"
複製代碼
  1. git push -u origin master
複製代碼

因為 remote 有新 commit, 你唔可以直接 push
一定 pull remote commit, merge 完之後先可以 push
咁樣係要確保兩邊 in sync

TOP

我想更新 github 的 py 檔,唔知做錯咩
傑洛 發表於 2020-9-15 09:18



  install 個GIT CLIENT 去做易好多...

TOP

install 個GIT CLIENT 去做易好多...
edl0025 發表於 15/9/2020 10:28



    因為我自學果陣用 CMD 去 run 程式碼,

自然集中在 CMD 做

p.s. 在 WFH 其間學 python

TOP

因為我自學果陣用 CMD 去 run 程式碼,

自然集中在 CMD 做

p.s. 在 WFH 其間學 python ...
傑洛 發表於 2020-9-15 10:47

用 CMD 先係最好

你可以做

git pull —rebase(建議)

git pull (不建議,因為會 Auto merge 起多一個無謂 Commit)

via HKEPC IR Extreme 4.2.3 - iOS(4.0.2)

TOP