This is a list of useful commands for git for fast search and ops developers, enjoy and comments for suggest all welcomes :D
Public repo .tar for download versions: https://www.kernel.org/pub/software/scm/git/
Delete with git all files listed as deleted:
$ git rm $(git ls-files --deleted)Delete a branch DOWN in the local repository:
$ git branch [branch name] --deleteDelete a branch UP in the services repository:
$ git push origin --delete [branch name]Do not track changes on specific file:
$ git update-index --assume-unchanged [file]Track changes again:
$ git update-index --no-assume-unchangedList hidden tracked files:
$ git ls-files -v | grep '^[[:lower:]]'Cleaning up cache when git ignore fail (options):
$ git rm -r --cached .
$ git add .
$ git commit -m "Fixed untracked files"Clone a repo specifying the branch:
$ git clone -b <branch> <myproject>.gitIgnore mode file change, setting up git:
$ git config core.fileMode falsegit checkout, doesn't work... possibilities:
$ git config --global core.autocrlf false
$ vim .gitattributes # comment line "* text=auto"Setting up git color:
$ git config --global color.ui trueRolling back a commit:
$ git reset --soft 'HEAD^'Discard last commit:
$ git reset HEAD --hard
$ git reset --hard origin/master
$ git reset --soft HEAD~1Merging conflicts (accept theirs):
$ git checkout --theirsMerging conflicts (accept ours):
$ git checkout --oursRemove a remote:
$ git remote rm <remote>Resolve problem with CRLF sequence:
$ git diff --ignore-space-at-eolAdd just tracked files to the stage:
$ git add -u .Revert changes on a specifuc file commited and begin again:
$ git checkout commit-reff~1 -- <file name>Remove the last commit and set the change to "Changed but not updated":
$ git reset HEAD~1Export a "clean" project:
$ git archive master | tar -x -C </somewhere/else>
$ git archive master | bzip2 > <source.tar.bz2>
$ git archive --format zip --output <zipfile.zip> masterNote: This is a synonym to svn export. What this does is export and compress a repository without any .git* files.
Removing file from all history: https://help.github.com/articles/remove-sensitive-data/
Setting global ignore
$ git config --global core.excludesfile ~/.gitignore_globalPretty git log
$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commitAlias git lg:
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"Turn off the warning CRLF
git config core.safecrlf falseChange domain to clone (bower)
$ git config --global url."https://".insteadOf git://Publish to github pages
$ git subtree push --prefix <my site folder> origin gh-pages
// Revertir los cambios de un archivo entre varios que fueron cometidos para hacerle un nuevo commit
PD. This not work at all with merged commits where conflicts were resolved manually editing file.