Git
Delete directory from history
git filter-repo --invert-paths --path filename
Can use --refs master..HEAD
to only change stuff between master and
current HEAD
Merge branch but discard its history (add a single commit)
- checkout target branch (e.g.,
master
) git merge --squash SOURCE_BRANCH
Alternative
- check out source branch (e.g.,
ci
) - soft reset to target branch (e.g.,
master
) - commit
- delete
master
& renameci
tomaster
- done!
Set all commit dates to author dates
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'
(https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date)
Sort uncommited files by modification time
Staged:
git diff --name-only --cached | xargs stat -c '%y %n' -- | sort
Modified, unstaged:
git ls-files -m | xargs stat -c '%y %n' -- | sort
Untracked (respecting .gitignore)
git ls-files -o --exclude-standard | xargs stat -c '%y %n' -- | sort
Spin subdirectory off into new repo
This works well: https://stackoverflow.com/a/17864475
(git subtree
is safe, it creates a new branch)