git branch -m master main git fetch origin git branch -u origin/main main git remote set-head origin -a
git commit --author="First Last [email protected]" --date "2021-01-18" -m "First person wrote this code. Christopher is committing it with a rough estimate of creation date."
# Go to repo that will receive merge
cd path/to/repo1
# Add remote to repo to be pulled/merged
git remote add repo2 /path/to/repo2
git fetch repo2 --tags
# merge repo2 into repo1. Repeat for each branch
git merge --allow-unrelated-histories repo2/master
git merge --allow-unrelated-histories repo2/main
git merge --allow-unrelated-histories repo2/develop
# Remove reference to the merged repo. Delete it once confirmed.
git remote remove project-a
# Global
git config --global user.name "Christopher W. Blake"
git config --global user.email "[email protected]"
git config --global user.email "[email protected]"
# Per Repo
git config user.name "Christopher W. Blake"
git config user.email "[email protected]"
git config --global core.excludesfile ~/.gitignore
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db
# Files that might appear on external disks
.Spotlight-V100
.Trashes
git filter-repo --path-glob '*.mp4' --invert-paths --force
git push origin --force --all
python git-filter-repo --path-glob '*.secrets' --invert-paths --force
python git-filter-repo
Reference: This is a python tool. If not installed in $PATH, it has to be called directuly using python. https://github.com/newren/git-filter-repo
git fetch --prune
git checkout --orphan <branch name>
git push target 'refs/remotes/origin/*:refs/heads/*'
Will prevent future changes to a file.
# Disable tracking
git update-index --skip-worktree <file>
# Reenable tracking
git update-index --no-skip-worktree <file>
git ls-files -v . | grep ^S
- Install on machine (if needed) brew install git-lfs
- Install for user (if needed) git lfs install
- Track a file type with LFS. git lfs track "*.psd"
- Ensure the .gitattributes file is tracked (for future clones). git add .gitattributes
Reference: https://git-lfs.com/
git lfs migrate import --include=".zip" git lfs migrate import --include=".zip" --include-ref=refs/heads/master --include-ref=refs/heads/my-feature
git push --force
Reference: https://github.com/git-lfs/git-lfs/wiki/Tutorial#migrating-existing-repository-data-to-lfs