Skip to content

Instantly share code, notes, and snippets.

@laurentsab
Last active November 8, 2016 08:32
Show Gist options
  • Save laurentsab/252b16b4d16c617d4e00 to your computer and use it in GitHub Desktop.
Save laurentsab/252b16b4d16c617d4e00 to your computer and use it in GitHub Desktop.
Git Tips
// Ajouter un submodule
$ git submodule add -b [branch] [ssh gitRepo] [destination folder]
// Annuler toutes les modifs et reviens au commit demandé.
$ git reset --hard [#commit]
// Delete a locale branch
$ git branch -D bugfix
Deleted branch bugfix (was 2a14ef7).
// Delete a remote branch
$ git push origin --delete <branchName>
ou $ git push origin :<branchName>
// Changer le message du dernier commit
$ git commit --amend -m "Fix typo."
// taguer un commit
$ git tag v1.0.0
// Pousser un tag
$ git push origin v1.0.0
// Force un nouveau commit sur le tag précédent
$ git tag -f v1.0.0
// Pousser le tag forcé sur le repo
git push -f --tags
(ou)
git push -f origin v1.4
// Vérifie si un fichier final [path] est ignoré
git check-ignore [-v] [path]
// Show modifications on one file
git log -p folder/file.html
// ignore les changements de droits dans les submodules
find ./.git/modules -type f -name 'config' -print0 | xargs -0 sed -i 's/filemode = true/filemode = false/g'
// blame -L[line start number], +11 [show next 11 lines]
git blame -L150,+11 -- git-web--browse.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment