Can I fetch a stash from a remote repo into a local branch?

前端 未结 3 422
悲哀的现实
悲哀的现实 2020-12-01 18:11

A colleague has a stash in their repository which I can access (via the filesystem), and I\'d like to pull that stash into a branch in my repository.

% git ls-rem         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 18:53

    Update: A direct answer to the original poster's question is:

    git send-pack ./ 3ccc82fb1ee0e7bde1250c7926d333ce21c109c0:refs/heads/tempbranch
    

    'tempbranch' will be at the latest stash (stash@{0}) from the remote. Unfortunately I don't think the reflog is fetched from remote branches, so there is no way to get at the other stashes, unless you have access to the source repo.

    Scripting it: I posted a more comprehensive 'scripted' solution over at the mentioned question

    Is it possible to push a git stash to a remote repository?

    Also, as I discovered in the meantime, git-send-pack can be instrumental if you have access to the source repo:

    git send-pack ../myworkingfolder/ stash@{0}:refs/heads/collegue_stash
    

提交回复
热议问题