Cheatsheet: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
remove without delete
remove without delete
   git rm --cached somefile.txt
   git rm --cached somefile.txt
rebase history
  git rebase -i HEAD~3


== Grep ==
== Grep ==
   grep -lr --include \*.[EXT] --exclude \*[TAIL] "[SEARCH1]" ./ | xargs grep -n [SEARCH2]
   grep -lr --include \*.[EXT] --exclude \*[TAIL] "[SEARCH1]" ./ | xargs grep -n [SEARCH2]

Revision as of 17:19, 20 December 2017

Git

undo commit

 $ git commit -m "Something terribly misguided"
 $ git reset HEAD~
 << edit files as necessary >>
 $ git add ...
 $ git commit -c ORIG_HEAD

find in history

 git log -S'the line from your file' -- path/to/your/file.txt

rename branch

 git branch -m new-name
 git push origin :old-name new-name
 git push origin -u new-name

remove without delete

 git rm --cached somefile.txt

rebase history

 git rebase -i HEAD~3

Grep

 grep -lr --include \*.[EXT] --exclude \*[TAIL] "[SEARCH1]" ./ | xargs grep -n [SEARCH2]