Skip to content

Instantly share code, notes, and snippets.

Denny Schulz dennschu

  • Germany
Block or report user

Report or block dennschu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Remove all git tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
View Git Subtree basics.md

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@dennschu
dennschu / Enable xdebug for PHPStorm 2018.2.md
Last active Nov 9, 2018
Laravel Homestead 7 – xdebug `/etc/php/7.2/mods-available/xdebug.ini`
View Enable xdebug for PHPStorm 2018.2.md

Tasks

  1. Add xdebug.remote_autostart = 1 to /etc/php/7.2/mods-available/xdebug.ini
  2. Activate xDebug for CLI
sudo ln -s /etc/php/7.2/mods-available/xdebug.ini /etc/php/7.2/cli/conf.d/20-xdebug.ini
  1. Add Remote CLI Interpreter (vagrant)
@dennschu
dennschu / delete_git_submodule.md
Created Nov 8, 2018 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@dennschu
dennschu / enable-guest-sharing.ps
Created Oct 22, 2018
Enable anonymous guest sharing in Teams - Powershell snippet
View enable-guest-sharing.ps
$teamurl="https://<admin-url>.sharepoint.com"
$siteurl="https://<tenant-name>.sharepoint.com/sites/<team name>"
Connect-SPOService -Url $teamurl
Get-SPOSite -Identity $siteurl | select SharingCapability
Set-SPOSite -Identity $siteurl -SharingCapability ExternalUserAndGuestSharing
@dennschu
dennschu / fix-homebrew-owner-perms.sh
Last active Apr 17, 2018 — forked from stefanschmidt/fix-homebrew-owner-perms.sh
Fix ownership and permissions of a multi-user Homebrew installation
View fix-homebrew-owner-perms.sh
# fix owner of files and folders recursively
sudo chown -vR $(whoami) /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix read/write permission of files and folders recursively
chmod -vR ug+rw /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix execute permission of folders recursively
find /usr/local /opt/homebrew-cask /Library/Caches/Homebrew -type d -exec chmod -v ug+x {} +
@dennschu
dennschu / language-switch-bookmarklet.js
Last active Mar 29, 2018
bookmarklet for switching languages from german to english
View language-switch-bookmarklet.js
javascript:(function() {
/* add this code starting at 'javscript:' as address to a bookmark entry */
var currentUrl = window.location.href;
var targetUrl = null;
var BreakException = {};
var replaceMatrix = [
{ search: '/de/', replace: '/en/'},
{ search: '/de-de/', replace: '/en-us/'}
];
@dennschu
dennschu / script.sh
Created Mar 7, 2018
Remove directory from git history
View script.sh
# unashamed copied from https://stackoverflow.com/a/17824718
RELATIVE_DIRECTORY="node_modules"
git filter-branch --tree-filter "rm -rf ${RELATIVE_DIRECTORY}" --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo "${RELATIVE_DIRECTORY}/ >> .gitignore
git add .gitignore
git commit -m "Removing ${RELATIVE_DIRECTORY} from git history"
git gc
@dennschu
dennschu / postgres-brew.md
Created Apr 14, 2017 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)
View postgres-brew.md

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@dennschu
dennschu / SimpleLogCheck.cs
Created Apr 11, 2017 — forked from cknaap/SimpleLogCheck.cs
Easily check ILogger<T> interactions with ASP.NET Core Logging and Moq
View SimpleLogCheck.cs
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Knaap.Utilties
{
You can’t perform that action at this time.