Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
John-Schlick opened this issue Jun 18, 2014 · 6 comments
Open

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

John-Schlick opened this issue Jun 18, 2014 · 6 comments

Comments

@John-Schlick
Copy link
Contributor

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:

clearAll(); $this->addCommandName(self::GIT_RESET_COMMAND); // if there is an option add it. if (!is_null($option)) { $this->addCommandSubject($option); if (!is_null($tagOrCommit)) { $this->addCommandSubject2($tagOrCommit); } } return $this->getCommand(); } }
@John-Schlick
Copy link
Contributor Author

Note: I'm happy to email any of this to you so that the formatting is kept.
Drop me a line at [email protected] at any time.

@matteosister
Copy link
Owner

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

@John-Schlick
Copy link
Contributor Author

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
Copy link

@matteosister
Copy link
Owner

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

I cannot accept changes by email!

@John-Schlick
Copy link
Contributor Author

There is now a pull request for this code:
#45

It is EXACTLY the code I proposed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants