matteosister / GitElephant

An abstraction layer for git written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with Stash and Pop

AndreFabris opened this issue · comments

There are no instructions how to use Stash and Pop. This all works as far as I can tell
$repo = Repository::open($installpath . $folder);
$repo->addGlobalConfig('user.email', 'abcd@abcd.com');
$repo->addGlobalConfig('user.name', 'John');
$repo->stashCreate();
$repo->stash('');
$repo->pull($git);

However now I want to pop the stashed changes. I need to pass the string $stash which I have no idea how to get. Whatever string I try to define or get from stashCreate I get something like:
stash pop 'stash@{install}'" with reason: stash@{install} is not a valid reference

Any ideas how to perform stash pop?

You can call the stashPop() method on the $repo. See code for arguments.

Yeah I know, I tried. The argument is string $stash which I have no idea what to pass. Tried a few things none worked.

I do not know what you tried, but as far as I know you need to pass the name of the stash which you can get e.g. from $repo->stashList()

Ok cheers, I will try to see can I get that name from the stashList()

Were you able to achive your objective? If so, is it ok if I close this issue? Also, I would love to accept a PR if you want to improve the documentation.

commented

No follow up received from the ticket author, I'm closing this.