Skip to content

Instantly share code, notes, and snippets.

@mjavadhpour
Last active October 21, 2017 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjavadhpour/fc7cb66ecc5443aa0292cef85b8fc390 to your computer and use it in GitHub Desktop.
Save mjavadhpour/fc7cb66ecc5443aa0292cef85b8fc390 to your computer and use it in GitHub Desktop.
Git usefull command

Delete all git branch with pattern:

$ git branch | grep " pattern " | xargs git branch -D

Remove file from git cache:

$ git rm --cached mylogfile.log
$ For a directory:
$ git rm --cached -r mydirectory

Show count of comits without merge commit:

$ git rev-list --no-merges --count HEAD ^develop

Cherry-pick range of comits step by step stackoverflow:

$ git rev-list --reverse --topo-order B^..D | while read rev 
  do 
    git cherry-pick $rev || break 
  done 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment