Adding your git ssh keys to docker container (for linux)

I wanted to have an option to use ssh keys I use for git not only on host machine but also on remote one made by docker. To do that I tried several ways how to push this key to container. There are some info on SSH forwarding but in the end what worked best for me is just simple mounting a file (ssh key) to php container (using docker4drupal by wodby).

Recursively renaming files and folders with PHP

I wanted to rename lots of filed and folders for my modules, but not to do it manually I made an php script that does this for me. Also I used my IDE to rename code(class names and methods). So just replace root where is the code you want to change file and folder names and do that for strings also.

Quickly create patch files from fixed contrib modules

You fixed something in contrib module and you want to create quick patch from that, if it spans through multiple commits, best way to do that is to make a patch from multiple commits, to combine them into one file, write this

GitLab revert the reverted merge

So you made a mistake and made a revert, then you want to introduce again the code you use in new merge, if you try to make merge request(MR) from branch you made original MR you reverted you will get nothing in that MR. This is not a bug, but a feature of git. Reverting does not roll back, but rather appends the revert to the front of the HEAD.

git stash error: unable to unlink old (Permission denied)

When you try to git stash and get some error like "error: unable to unlink old" with permission denied with it, it is at is says permission problem, but not on that file, but directory where that file is.  So go to that folder where the problematic file is (usually it will be default folder) and give that folder permissions to write for user and group.

Add GIT branch to terminal prompt, works in your IDE also (PHPSTORM)

# Git branch in prompt.

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "

So open ~/.bash_profile in your favorite editor and add the above content to the bottom.