Skip to content

Latest commit

 

History

History
88 lines (53 loc) · 1.91 KB

UsefulTools.md

File metadata and controls

88 lines (53 loc) · 1.91 KB

Useful Tools

Useful Tools Git

Git Completion

This allows you to use tab completion for git commands, branches, tags, etc.

To set up:

  1. Download the completion script according to your shell here
  2. Add the following to your .bashrc, .bash_profile, or equivalent (replace .bash with your shell as needed)
source git-completion.bash

Git Prompt

This allows you to show your current branch or other information in your terminal.

Example:

git prompt

To set up:

  1. Download the git prompt script here

  2. Add the following to your .bashrc, .bash_profile, or equivalent

source git-prompt.sh

Add the following as part of your PS1 variable in your .bashrc, .bash_profile, or equivalent:

$(__git_ps1 " (%s)")

e.g.:

export PS1='\[\033[33m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[36m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '

Difftool

Compare diffs with a nicer user interface

e.g. do the following for VS Code:

git config --global diff.tool vscode

git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'

Also available with other tools like:

Mergetool

Similar to difftool but for merging changes

e.g. do the following for Sublime Merge:

git config --global merge.tool smerge
git config --global mergetool.smerge.cmd 'smerge mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"'

Available with:


Go Back To Table of Contents