簡體   English   中英

創建了github頁面后,如何修改git工作流程?

[英]How to modify my git workflow now that I created github pages?

我有一個本地存儲庫,我每天都在該存儲庫上工作。 通常,在一天的工作之后,我在本地進行提交,然后通過執行以下操作將所有內容推送到github存儲庫:

git add --all
git status // to check which changes are to be commited 
git commit -m "Some changes I've made"
git push origin master

最近,我通過單擊在線創建工具為在線存儲庫創建了一個github頁面。 現在,我的項目頁面很漂亮,並且在線倉庫上還有一個新的分支(稱為gh-pages)(但是,到目前為止,當然不在本地倉庫上)。

我的問題是:如果我想在計算機上本地編輯此頁面,並使兩個存儲庫保持同步(本地和github一個),該怎么辦? 我應該如何修改git工作流程?

提前致謝。

您只需使用git checkoutmaster等和gh-pages之間來回切換。 下面有更多詳細信息。

您的原始工作流程(來自上方):

git add --all
git status // to check which changes are to be commited 
git commit -m "Some changes I've made"
git push origin master

現在,當您要在GH頁面上工作時:

git fetch origin    # Only needed first time
git checkout gh-pages
# Make changes to your GH-pages files (your master branch files won't be available w/o switching back to master)
git add .    # or specific specific files to add
git commit -m "Commit message for GH-pages"
git push origin gh-pages

當您想回到主,開發等分支項目上工作時,只需將其簽出即可:

git checkout master

該信息可以在https://help.github.com/articles/creating-pages-with-the-automatic-generator/的底部找到。

手動創建gh-pages孤兒分支時,此過程稍微復雜一些: https//help.github.com/articles/creating-project-pages-manually/

當然,如果您不是唯一在倉庫上工作的人,或者是從多台計算機上進行工作,請確保在需要時fetch / mergepull fetch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM