Skip to content

Instantly share code, notes, and snippets.

@GuySartorelli
GuySartorelli / reset-commits.md
Last active March 11, 2024 20:54
How to reset commits on a pull request after retargetting it to a new branch

Resetting commits after retargetting a pull request

Sometimes after retargetting a pull request to a new branch, you'll find a lot of new commits are added to the PR that weren't there before. This is because the branch you used to create the pull request has additional commits on it that aren't in your new target branch.

Solution one: Reset commits

# Show the last commit(s) in your PR branch
@jkersu
jkersu / gist:f7ae8bdacb7a7178662ca2701c355167
Created December 1, 2021 03:26
Add a button to a Silverstripe Page in the CMS
// Add an extension to SilverStripe\Admin\LeftAndMain
class LeftAndMainExtension extends Extension
{
public function someFancyAction($data, $form)
{
// do some fancy stuff
}
}
<?php
namespace Nightjar\SS4UpgradeTasks;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use SilverStripe\Assets\File;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
<?php
namespace App\Extensions;
class BaseElementExtension extends Extension
{
/**
* Flag to indiciate if this element is a new element. Used because isChanged('ID') seems to be unreliable
*
* @var bool