我在笔记本电脑和台式机上有GitHub仓库的本地副本.桌面领先于笔记本电脑和远程GitHub origin
.我想将更改添加到笔记本电脑上,但不想向公众推送origin
.如何将USB记忆棒/外置硬盘设置为遥控器?
bin*_*unt 17
将USB驱动器插入桌面,并假设它显示为 J:
初始化将充当远程的裸仓库:
git init --bare J:\repo_name
Run Code Online (Sandbox Code Playgroud)cd
到当地的回购和:
git remote add usb J:\repo_name
git checkout master
git push usb master
Run Code Online (Sandbox Code Playgroud)该master
分支同步与usb
遥控器.现在将USB驱动器插入笔记本电脑,并假设它显示为D:
git remote add usb D:\repo_name
git checkout master
git pull usb master
Run Code Online (Sandbox Code Playgroud)
如果您试图拉出笔记本电脑上不存在但在桌面上存在的分支,您可以这样做git checkout the_branch
,它会自动拉出它usb
(除非the_branch
也存在origin
,在这种情况下你必须这样做git checkout -b the_branch usb\the_branch
)
git fetch
如果找不到远程usb分支,则可能需要.
如果以后插入USB驱动器并显示为不同的字母,例如K:
,则执行以下操作:
git remote set-url usb K:\repo_name
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6696 次 |
最近记录: |