Skip to content

Instantly share code, notes, and snippets.

@srpouyet
Created December 20, 2011 16:34
Show Gist options
  • Save srpouyet/1502193 to your computer and use it in GitHub Desktop.
Save srpouyet/1502193 to your computer and use it in GitHub Desktop.
Handy Commands

#Handy GIT Commands

Configure diffmerge as git's default merge and diff tool:

 git config --global diff.tool diffmerge
 git config --global difftool.diffmerge.cmd "diffmerge \"\$LOCAL\" \"\$REMOTE\""
 git config --global merge.tool diffmerge
 git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\"\$MERGED\" \"\$LOCAL\" \"\$BASE\" \"\$REMOTE\""
 git config --global mergetool.diffmerge.trustexitcode false

- source

TAR.GZ

tar: $ tar -zcvf archive_name.tar.gz directory_to_compress

untar: $ tar -zxvf archive_name.tar.gz [-C /tmp/extract_here/]

#Handy VIM Commands

The present working directory can be displayed in Vim with: :pwd

To change to the directory of the currently open file (this sets the current directory for all windows in Vim): :cd %:p:h

You can also change the directory only for the current window (each window has a local current directory that can be different from Vim's global current directory): :lcd %:p:h

In these commands, % gives the name of the current file, %:p gives its full path, and %:p:h gives its directory (the "head" of the full path).

source

Auto indent all lines with gg=G. Explanation: gg goes to the top of the file, = is a command to fix the indentation and G tells it to perform the operation to the end of the file. source

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