Created
February 12, 2011 23:49
-
-
Save SuzanneSoy/824250 to your computer and use it in GitHub Desktop.
My knowlege about git.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Généralités | |
# Créer un dépôt | |
git init | |
# Prendre en compte des modifs / découvrir un fichier | |
git add fichier | |
# Prendre en compte seulement une partie des modifs | |
git add -p fichier | |
# Ajouter toutes les modifs, ajouts, suppressions (unstaged) | |
git add -u | |
# Enregistrer des modifs (demande le message) | |
EDITOR=nano | |
git commit | |
# Enregistrer des modifs (avec message) | |
git commit -m | |
# Enregistrer toutes les modifs sur les fichiers connus | |
git commit -a | |
## Manipulation de dépôt | |
# Compresser le dépôt | |
git repack -a -d --depth=250 --window=250 | |
# Crée un dépôt NOUVEAU qui ne contient que SUBDIR du dépôt ORIGINAL | |
git clone --no-hardlinks ORIGINAL NOUVEAU | |
git filter-branch --subdirectory-filter SUBDIR HEAD -- --all | |
git reset --hard | |
git gc --aggressive | |
git prune | |
# Corriger les auteurs des commit | |
git filter-branch --env-filter ' | |
while read email_from; do | |
email_to="${email_from#*|}" | |
email_from="${email_from%%|*}" | |
if [ "$GIT_AUTHOR_EMAIL" = "$email_from" ]; then export GIT_AUTHOR_EMAIL="$email_to"; fi | |
if [ "$GIT_COMMITTER_EMAIL" = "$email_from" ]; then export GIT_COMMITTER_EMAIL="$email_to"; fi | |
done <<EOF | |
[email protected]|[email protected] | |
bad@localhost|[email protected] | |
otherbad@localhost|[email protected] | |
EOF | |
while read name_from; do | |
name_to="${name_from#*|}" | |
name_from="${name_from%%|*}" | |
if [ "$GIT_AUTHOR_NAME" = "$name_from" ]; then export GIT_AUTHOR_NAME="$name_to"; fi | |
if [ "$GIT_COMMITTER_NAME" = "$name_from" ]; then export GIT_COMMITTER_NAME="$name_to"; fi | |
done <<EOF | |
John|John Doe | |
RMS|Me -- mwahaha | |
user|John Doe | |
EOF | |
' HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment