From ede31a5b587821d19d6bf832d4204f9855efb676 Mon Sep 17 00:00:00 2001 From: Andres Hermosilla Date: Thu, 24 Aug 2017 15:27:13 -0700 Subject: [PATCH] Reformatted git notes --- git.md | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/git.md b/git.md index 682d70f..ce6f5df 100644 --- a/git.md +++ b/git.md @@ -1,19 +1,29 @@ # git -- Files changes in a commit - `git diff-tree --no-commit-id --name-only -r c06d5186ed7` -- Last commit files changes - `git rev-parse HEAD | xargs -I {} git diff-tree --no-commit-id --name-only -r {}` -- Current files - `git status -s | grep php | sed 's/^ *//' | cut -d' ' -f2` -- Pipe to lint quickly - `xargs -I {} php -l {}` - `git rev-parse HEAD | xargs -I {} git diff-tree --no-commit-id --name-only -r {} | xargs -I {} php -l {}` -- Php file changes in a merge - `git log -1 --name-only | grep '.php' | xargs -I{} php -l {}` -- Show files changes between branches - `git diff remotes/origin/master remotes/origin/security-tweak --name-only` -- Git show pending merges -`git show-ref | grep merge | cut -d' ' -f1 | xargs -I{} git show {}` +```bash +# Files changes in a commit +git diff-tree --no-commit-id --name-only -r c06d5186ed7 + +# Last commit files changes +git rev-parse HEAD | xargs -I {} git diff-tree --no-commit-id --name-only -r {} + +# Current files +git status -s | grep php | sed 's/^ *//' | cut -d' ' -f2 + +# Pipe to lint quickly changes +git rev-parse HEAD | xargs -I {} git diff-tree --no-commit-id --name-only -r {} | xargs -I {} php -l {} + +# Php file changes in a merge +git log -1 --name-only | grep '.php' | xargs -I{} php -l {} + +# Show files changes between branches +git diff remotes/origin/master remotes/origin/security-tweak --name-only + +# Git show pending merges +git show-ref | grep merge | cut -d' ' -f1 | xargs -I{} git show {} + +# Bring changes into your branch without commits +git merge --no-commit --squash other_branch +``` - https://github.com/blog/2019-how-to-undo-almost-anything-with-git \ No newline at end of file