Skip to content

Instantly share code, notes, and snippets.

@latortuga
Created January 5, 2011 17:55
Show Gist options
  • Save latortuga/766687 to your computer and use it in GitHub Desktop.
Save latortuga/766687 to your computer and use it in GitHub Desktop.
git tricks
"TortoiseMerge.exe" "$2" "$5" | cat

Make an existing git branch track a remote branch git branch --set-upstream local_branch remote_name/remote_branch

Make an annotated tag git tag -a tag_name commit_ref

Push a local branch to remote git push remote_name local_branch_name

Push a local branch to remote with a new name git push remote_name local_branch_name:shared_branch_name

Delete a remote branch when finished sharing it git push remote_name :local_branch_name

My gitconfig

[core]
    editor = "\"c:\\Program Files (x86)\\Vim\\vim72\\gvim.exe\" %*"
    autocrlf = true
[color]
    branch = auto
    diff = auto
    status = auto
    interactive = auto
    ui = true
[alias]
    co = checkout
    br = branch
    st = status
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
    nb = checkout -b
[diff]
    external = ~/git-differ.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment