pr:git-stuff
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Git-Tricks
Commit-Datum ändern (z.B. Import alter Code)
GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!' GIT_AUTHOR_DATE='2029-12-19 15:14:05 -0800' git commit -m 'future!' GIT_AUTHOR_DATE="`date -Iseconds -u -r 'oldest file'`" git commit -m 'past!'
Unterverzeichnisse rausziehen
To rewrite the repository to look as if foodir/ had been its project root, and discard all other history:
git filter-branch --subdirectory-filter ABC --prune-empty -- --all
Remove directory from history:
git filter-branch --index-filter "git rm -q -r -f --cached --ignore-unmatch ABC" --prune-empty -- --all
Mit Subtree:
## create branch that tracks only MyLibraryRepo/* git subtree split -P MyLibraryRepo -b export ## make new repo cd ~/Projects mkdir LibraryRepo cd LibraryRepo git init # copy over commits... git fetch ../bigrepo export # ... and define master as them git checkout -b master FETCH_HEAD
Changelog
git log --format="- %B" --reverse Previous-Release..HEAD
Branch verschieben
Beispiel: Feature-Branch vergessen, 2 commits sind schon auf master (aber nicht gepusht)
git update-ref refs/heads/master `git rev-parse master^2`
Revision in git-svn Import suchen
Repo ist ein git-svn Mirror, wir suchen den Commit in dem eine bestimmte SVN-Revision gelandet ist
git log | grep -B8 -A1 @34724
Dateidatum auf das Datum des letzten Commits setzen
pr/git-stuff.1546456048.txt.gz · Zuletzt geändert: 2019/01/02 20:07 von martok