Skip to content

Instantly share code, notes, and snippets.

View paulie4's full-sized avatar

Paulie Peña paulie4

  • Jamaicaway Tower & Townhouses
View GitHub Profile
@paulie4
paulie4 / git-rm-files-from-index.sh
Last active December 11, 2015 20:09
Use this script to remove .gitignored files from a git repository's index, but to not remove the files locally. It should be run on all machines that need to preserve the .gitignored files, since a "git pull" or "git checkout <branch>" would remove them otherwise (original idea from http://www.arlocarreon.com/blog/git/untrack-files-in-git-repos-…
#/bin/bash
## Note: All machines should be up to date before any of them run this script,
## and at least one machine should have all the remote branches checked out.
## Use this script to remove .gitignored files from a git repository's index,
## but to not remove the files locally. It should be run on all machines that
## need to preserve the .gitignored files, since a "git pull" or "git checkout
## <branch>" would remove them otherwise (original idea from
## http://www.arlocarreon.com/blog/git/untrack-files-in-git-repos-without-deleting-them/).
@paulie4
paulie4 / gitCopyFile.py
Created March 31, 2021 00:55
workaround for lack of "copy" in git
# Since Git does not have a way to copy files, this implements the workaround from here:
# https://stackoverflow.com/a/46484848/2016290
import argparse
import os
import subprocess
TMP_BRANCH = 'tmpToCopyFile'
def gitCopyFile(origPath, newPath):