Skip to content

Instantly share code, notes, and snippets.

@ventrec
ventrec / copy-git-commits.md
Created July 1, 2021 07:43
How to copy git commits from one repository to another.

How to copy git commits from one repository to another.

  1. Identify the git hash for the first commit and the last commit that you would like to transfer.
  2. Run the following command in the repository that you would like to copy commits from: git format-patch --output-directory="commits" sha1^..sha2.
  3. Navigate to the repository that you would like to copy the commits into.
  4. Run the following command: git am --keep-cr -3 /path/to/other/repository/commits/*.patch
@ventrec
ventrec / handy_git_commands.md
Last active July 4, 2018 11:56
Handy git commands

Reset a single file to head:

git checkout @ -- myfile.ext

Show git diff for a single file:

git diff @ myfile.ext

@ventrec
ventrec / phpstorm_settings_backup_guide.md
Last active January 16, 2018 12:12
How to backup and restore your PhpStorm settings through the terminal (version 2016 ++) on MacOS

Backup settings:

  1. Navigate to your Preferences folder, usually found in /Users/<user>/Library/Preferences
  2. Run the following command tar -zcvf phpstorm_settings.tar.gz PhpStorm2017.3/ (Filename can be whatever, including a custom path. The folder name will be the folder covering your version of phpstorm)

Restore settings:

  1. Delete current folder in preferences
  2. Run the following command tar -zxvf phpstorm_settings.tar.gz (will extract to the current folder)