Voir fichier à un commit :
git show HASH:path/to/file
Hash du commit initial :
git rev-list --max-parents=0 HEAD
Voir liste fichiers modifiés entre 2 commits :
git diff --name-only SHA1 SHA2
git log --name-status --oneline HEAD~6..HEAD
git log --name-status --oneline HEAD~6..HEAD |grep -vP '^\S[^\s]'|sort|uniq
Voir modif sur un fichier entre 2 commits :
git diff SHA1 SHA2 main.c
Trouver l'ancetre commun le plus vieux
git config --global alias.oldest-ancestor '!bash -c '\''diff -u <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | sed -ne "s/^ //p" | head -1'\'' -'
git oldest-ancestor
git rebase -i [HASH parent]
man -7 gitrevisions
HEAD
HEAD~1 HEAD^ HEAD^1
HEAD~2 HEAD^2 HEAD~1^
HEAD~3
10:10 V /tmp/git_test [master L|V]
$ git lola
HEAD^ is the revision before the current
HEAD~2 is the same as HEAD^^ and the revision before HEAD^
git branch -a --sort=-committerdate
je découvre ce plugin vim qui a l'air juste magique pour interagir avec git
il faut que je me fasse au workflow "Branch updater"
The -m option specifies the parent number. This is because a merge commit has more than one parent, and Git does not know automatically which parent was the mainline, and which parent was the branch you want to un-merge.
When you view a merge commit in the output of git log, you will see its parents listed on the line that begins with Merge:
commit 8f937c683929b08379097828c8a04350b9b8e183
Merge: 8989ee0 7c6b236
Author: Ben James ben@example.com
Date: Wed Aug 17 22:49:41 2011 +0100
Merge branch 'gh-pages'
Conflicts:
README
In this situation, git revert 8f937c6 -m 1 will get you the tree as it was in 8989ee0, and git revert -m 2 will reinstate the tree as it was in 7c6b236.
don't fucking commit useless binary files !!
.ssh/authorized_keys
environment="GIT_AUTHOR_NAME=Arnaud M",environment="GIT_AUTHOR_EMAIL=arnaud@foo.bar",environment="GIT_COMMITTER_NAME=Arnaud M",environment="GIT_COMMITTER_EMAIL=arnaud@foo.bar" ssh-rsa .....
Peut être pratique quand plusieurs personnes commit depuis le même serveur (pour avoir un historique git avec les noms..)
Un workflow git qui a le mérite d'être simple : le cactus
Ptetre qu'un jour je passerai à zsh (ohmyzsh)
En attendant je bricole
Pour cancel un commit qui n'a pas encore été push
git reset --soft HEAD^
Show what will be deleted with the -n option:
git clean -f -n
Then - beware: this will delete files - run:
git clean -f
Pratique pour cloner en http
servir betement avec apache