js#vista.png msort nsort
js#vista.png msort nsort
Here it is. The cheatsheet I always find handy when dealing with GIT.
1. cd /path/to/git/localrepo 2. svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo" 3. git svn init protocol:///path/to/repo/PROJECT -s 4. git svn fetch 5. git rebase trunk 5.1. git status 5.2. git add (conflicted-files) 5.3. git rebase --continue 5.4. (repeat 5.1.) 6. git svn dcommit
When applying/popping a stash and everything just decides to dump on you then you may have no other option:
git reset --hard
Have your terminal prompt display what branch you are currently on in red.
function parse_git_branch_and_add_brackets {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h\[\033[0;31m\]\$(parse_git_branch_and_add_brackets) \[\e[33m\]\w\[\e[0m\]\$ "
Generates a prompt such as:
# aliases for common git commands
alias g='git'
alias st='git status'
alias push='git push'
alias commit='git commit'
alias log='git log'
alias stash='git stash'
alias checkout='git checkout'
alias branch='git branch'
alias fetch='git fetch'
alias merge='git merge'
alias cherry-pick='git cherry-pick'
alias rebase='git rebase'
# 'git pull --rebase' with a short log of the latest changes
pull () { local HEADHASH=`git describe --always --abbrev=40`; git pull --rebase $*; echo; PAGER='cat -B' git log --format="%C(yellow)%h %C(green)%an%C(reset): %s" $HEADHASH.. | sed -nr 's/([^:]+)\:/\1\t/;p'; }
# 'git pull --ff-only' with a short log of the latest changes
ff () { local HEADHASH=`git describe --always --abbrev=40`; git pull --ff-only $*; echo; PAGER='cat -B' git log --format="%C(yellow)%h %C(green)%an%C(reset): %s" $HEADHASH.. | sed -nr 's/([^:]+)\:/\1\t/;p'; }
# verbose add
add () { git add -v $*; git status; }
# verbose reset
reset () { git reset $*; git status; }
# 'git add' with 'git ls-files' and grep
# usage like grep - example: gadd 'readme.txt'
gadd () { git ls-files -co --exclude-standard | grep $* | xargs git add -v; git status; }
# 'git reset' with 'git ls-files' and grep
greset () { git ls-files | grep $* | xargs git reset; git status; }
# Enable auto-completion for aliased 'git' command
complete -o default -o nospace -F _git g
get_git_branch() {
echo `git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
}
alias gpull='git pull origin `get_git_branch`'
alias gpush='git push origin `get_git_branch`'