Skip to content

Instantly share code, notes, and snippets.

@jorwan
Forked from frangeris/commands.md
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save jorwan/602e07d2bcd7828f5659 to your computer and use it in GitHub Desktop.

Select an option

Save jorwan/602e07d2bcd7828f5659 to your computer and use it in GitHub Desktop.

GIT

[PUBLIC REPO .tar] https://www.kernel.org/pub/software/scm/git/

[DELETE ALL RM] git rm $(git ls-files --deleted)

[DELETE BRANCH DOWN] git branch --delete

[DELETE BRANCH UP] git push origin --delete

[DONT TRACK CHANGES] git update-index --assume-unchanged

[TRACK CHANGES] git update-index --no-assume-unchanged

[LIST HIDDEN TRACKS] git ls-files -v | grep '^[[:lower:]]'

[CLEANING UP CACHE WHEN GIT IGNORE FAIL] git rm -r --cached . git add . git commit -m "Fixed untracked files"

[CLONE BRANCH] git clone -b git@:/.git

[IGNORE MODE FILE] git config core.fileMode false

[CHECKOUT DOESN'T WORK] git config --global core.autocrlf false vim .gitattributes # comment line "* text=auto"

[GIT COLOR] git config --global color.ui true

[ROLLING BACK A COMMIT] git reset --soft 'HEAD^'

[DISCARD LAST COMMIT] git reset HEAD --hard git reset --hard origin/master

[ACCEPT THEIRS MERGE] git checkout --theirs

[ACCEPT OURS MERGE] git checkout --ours

[REMOVE REMOTE] git remote rm

[PROBLEM CRLF SEQUENCE] git diff --ignore-space-at-eol

[REMOVE FILE FROM ALL HISTORY] https://help.github.com/articles/remove-sensitive-data/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment