matteosister / GitElephant

An abstraction layer for git written in PHP
GNU Lesser General Public License v3.0
613 stars 74 forks source link

Implement "reset" command (solution code included) #44

Open John-Schlick opened 10 years ago

John-Schlick commented 10 years ago

In order to implement the reset command, in Repository add the following use command: use GitElephant\Command\ResetCommand;

Now add the following function to Repository: /* * Reset this branch of the repository * @param string $option usually --hard * @param tag $the tag to use as the reference for the reset * @throws \RuntimeException * @throws \InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return Repository / public function reset($option = null, $tag = null) { $this->caller->execute(ResetCommand::getInstance()->reset($option, $tag));

    return $this;
}

and add the following file to the Command directory using hte name ResetCommand.php for the filename: <?php /**

namespace GitElephant\Command;

use GitElephant\Objects\Branch; use GitElephant\Objects\Remote;

/**

John-Schlick commented 10 years ago

Note: I'm happy to email any of this to you so that the formatting is kept. Drop me a line at John_Schlick@hotmail.com at any time.

matteosister commented 10 years ago

Thanks for taking your time...this could be a useful addition. Could you please send a pull request?

John-Schlick commented 10 years ago

How do I do that without the ability to make a branch in this repository? Like I said, I'm happy to mail you the updates. And in this case, it's a line and a function in Repository.php and a new file, so it's not like it's changes all over the codebase.

franzliedke commented 10 years ago

Create a fork: https://help.github.com/articles/using-pull-requests

matteosister commented 10 years ago

https://help.github.com/articles/fork-a-repo

I cannot accept changes by email!

John-Schlick commented 10 years ago

There is now a pull request for this code: https://github.com/matteosister/GitElephant/pull/45

It is EXACTLY the code I proposed above.