我是 github 的新手。我從
git remote add origin URL
這將我的本地檔案與 github 帳戶相關聯。然后我做了:
git push -u origin master
這將我的檔案復制到 github
然后我繼續對本地存盤庫中的 .py 檔案進行一些更改,然后將其保存。我這樣做是為了測驗提交 推送功能。接下來我輸入:
git add.
git status
git commit -m "Q1 solution"
git push
代碼推送到 github 但我不確定我是否正確執行。Youtube 視頻都說我應該做 git push origin(別名 URL)。完成初始設定后,我需要這樣做還是 git push 足夠了:
git push -u origin master
編輯:
git status
給我:
On branch master
Your branch is up to date with 'origin/master'.
不知道這是什么意思起源/主人?!?
謝謝,
uj5u.com熱心網友回復:
-u選項git push意味著:
-u
--set-upstream對于每個最新或成功推送的分支,添加上游(跟蹤)參考,由無引數 git-pull 和其他命令使用。
所以從那時起,單獨運行git push與運行相同git push origin master——在這兩種情況下,您都在說“將我master的分支推送到master名為遠程的分支origin”。
當您看到訊息時:
Your branch is up to date with 'origin/master'.
這意味著您已經將本地分支與遠程分支同步。
uj5u.com熱心網友回復:
我的朋友,您將其正確推送到主分支
當我們使用:
git push
它會自動推送到 repo 并推送到您所在的分支,即 master 分支
我什么時候應該使用全手版?
git push [alias] [branch]
git push origin main/master
當我們想將更改推送到另一個分支時,我們使用這個
你可以
在 git 中創建一個分支
git branch [name]
那么您只想在這個分支中進行更改,您應該暫存它
git checkout [name of the branch]
并且您可以添加或提交而不更改其他分支中的任何內容
檢查此備忘單 https://education.github.com/git-cheat-sheet-education.pdf
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/480019.html
標籤:混帐
下一篇:git中的快照識別符號?
