我有2臺電腦,一個辦公室,一個在家裏,我們使用git進行版本控制,我想用它來同步我的作品,通常甚至不準備好一個小提交,所以我不想在我們的gitlab服務器中留下提交信息。我想到的第一個想法是git藏,我可以git stash
我目前的工作?並將存儲推送到遠程服務器。然後把git藏在另一臺電腦中,並通過git pop恢復工作。像這樣:同步的工作原理是混帳在不同的計算機
這不完全是步驟,但你可以得到我的想法。
第1步:在電腦辦公
git stash
git push (the stash contents)
步驟2:在電腦首頁
git pull # pull the stash contents
git stash pop # pop the difference I already git stash in the Computer-office
# some modified, new files and delete some files.
git stash
git push (the stash contents)
步驟3:在計算機辦公
git pull # pull new stash content at home
git commit # the final commit
也許你可以創建另一個分支來提交你的小提交,把它放在家裏,最後在與主分支合併時將多個提交壓縮成一個。 https://git-scm.com/book/zh/v2/Git-Tools-Rewriting-History#Squashing-Commits –
我曾考慮過這個問題,但覺得藏箱可以更容易地彈出。 –
我想@VonC回答了你的問題 –