Skip to content

Instantly share code, notes, and snippets.

@lschatzkin
Created September 28, 2015 15:57
Show Gist options
  • Save lschatzkin/a403b79f65e4334a281d to your computer and use it in GitHub Desktop.
Save lschatzkin/a403b79f65e4334a281d to your computer and use it in GitHub Desktop.
git clean -f =>DELETES untracked WARNING!!!!!
git reflog -- summary with commit #, then:
GO BACK TO PREV COMMIT:
git reset ---hard <filename>
REMOVE COMMITTED:
git reset HEAD <file>
UN-ADD files => git reset FILE
RESTORE PREV VER OF 1 FILE=>
git checkout <commit #> file/to/restore
UNDO COMMIT & REDO:
git commit ...
git reset --soft HEAD^
edit
git add ....
git commit -c ORIG_HEAD
AUTOMERGE CONFLICT
git add <file with conflict>
git commit
git push
FORCE push (R U SURE?????)=>git push -f
HISTORY=>git log
SHOW FILE CHANGES=>git diff $id1 $id2 (id= git log #)
VIEW FILE w/DIFFS => git log -p $file -
git diff --name-only HEAD~10 HEAD~5
SHOW REMOTE REPO =>git remote -v
CHANGE REPO => edit .git/config
GUI MERGE => git mergetool
GIT ADD:
git add -A stages All
git add . stages new and modified, without deleted
git add -u stages modified and deleted, without new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment