Skip to content

Commit 60e2880

Browse files
committed
Added missing methods for extra git commands
1 parent b1d8c94 commit 60e2880

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

CI_Git.php

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,99 @@ public function checkout($branch) {
396396
return $this->run("checkout $branch");
397397
}
398398

399+
400+
/**
401+
* Runs a `git merge` call
402+
*
403+
* Accepts a name for the branch to be merged
404+
*
405+
* @access public
406+
* @param string $branch
407+
* @return string
408+
*/
409+
public function merge($branch)
410+
{
411+
return $this->run("merge $branch --no-ff");
412+
}
413+
414+
415+
/**
416+
* Runs a git fetch on the current branch
417+
*
418+
* @access public
419+
* @return string
420+
*/
421+
public function fetch()
422+
{
423+
return $this->run("fetch");
424+
}
425+
426+
/**
427+
* Add a new tag on the current position
428+
*
429+
* Accepts the name for the tag and the message
430+
*
431+
* @param string $tag
432+
* @param string $message
433+
* @return string
434+
*/
435+
public function add_tag($tag, $message = null)
436+
{
437+
if ($message === null) {
438+
$message = $tag;
439+
}
440+
return $this->run("tag -a $tag -m $message");
441+
}
442+
443+
444+
/**
445+
* Push specific branch to a remote
446+
*
447+
* Accepts the name of the remote and local branch
448+
*
449+
* @param string $remote
450+
* @param string $branch
451+
* @return string
452+
*/
453+
public function push($remote, $branch)
454+
{
455+
return $this->run("push --tags $remote $branch");
456+
}
457+
458+
/**
459+
* Pull specific branch from remote
460+
*
461+
* Accepts the name of the remote and local branch
462+
*
463+
* @param string $remote
464+
* @param string $branch
465+
* @return string
466+
*/
467+
public function pull($remote, $branch)
468+
{
469+
return $this->run("pull $remote $branch");
470+
}
471+
472+
/**
473+
* Sets the project description.
474+
*
475+
* @param string $new
476+
*/
477+
public function set_description($new)
478+
{
479+
file_put_contents($this->repo_path."/.git/description", $new);
480+
}
481+
482+
/**
483+
* Gets the project description.
484+
*
485+
* @return string
486+
*/
487+
public function get_description()
488+
{
489+
return file_get_contents($this->repo_path."/.git/description");
490+
}
491+
399492
}
400493

401494
/* End of file CI_Git.php */

0 commit comments

Comments
 (0)