Tuesday, August 27, 2013

windows python path bug

had a weird bug trying to import numpy:
...
from numpy.linalg import lapack_lite
ImportError: DLL load failed: The specified module could not be found.

looks like it's actually because the python Scripts dir needs to be in the path
http://bugs.activestate.com/show_bug.cgi?id=89474

export PATH=$PATH:/cygdrive/c/Python27/Scripts/
made it work.

Monday, August 19, 2013

git - merging a merge from a clone

still trying to figure git out.... i had a clone in which i had forked off a previous commit and made some changes, then did a merge to bring both branches together. now i need to bring that merged update (along with the intermediate forked-off commit, if possible) to the origin. 'git fetch file:///remote' didn't seem to do anything, and even after 'git merge' i didn't see those other commits in my original repo.

finally, the thing that seemed to do the trick was 'git merge FETCH_HEAD'. so i guess git fetch grabbed the info, but it just didn't make it visible. the clue was the return from 'git fetch':
* branch HEAD -> FETCH_HEAD

now my repos match.

git baby steps

http://www.youtube.com/watch?v=ZDR433b0HJY

gitref.org
gitpro.org
whygitisbetterthanx.com
git svn

git config --global user.name "Trevor Tippetts"
git config --global user.email "trevorbtippetts@gmail.com"
git config --global color.ui true
git init
git clone git://github.com/schaco/ticgit.git

git add (file) # snapshots; commit will take files as they were at time of 'git add'
git status # -s gives one-liner summaries
git diff # patch for unstaged changes
git diff --cached # patch for staged but uncommitted changes
git diff HEAD # patch for staged and unchanged (everything since commit, ignoring staging)
git diff --stat # summary of changes

git commit -m 'my comment' # commits changes present at the time of git add
git commit -a # svn style commit snapshot at present time; auto stages everything
git add -p # stage patches; it will ask about each diff block

git branch # create branch or view local branches
git branch -r # view remote branches
git checkout # switch between branches
git checkout -b newBranchName # create a branch and switch to it immediately
git checkout master; git merge newBranchName
git status # will show files needing merge
git log [file] # show commits on 2 sides that created the conflicts in conflicted file
git mergetool # external: kdiff3 tkdiff xxdiff meld gvimdiff opendiff emerge vimdiff
git add [merged file] # will take this snapshot as the new (merged) file on next commit
git commit

git branch -d newBranchName # safely delete (only delete if it is reachable in the history of HEAD)
git branch -D branch # unsafely delete (changes on that branch might not be reachable by any other branch)

git push origin master # move remote master branch to local master branch
git fetch # get remote changes and new remote origin master; then you can do normal merge and re-push
git push origin iss53 # make/move remote branch pointer iss53, not master

git pull # wrapper to fetch and merge a branch; can be confusing if not working on master or not familiar with tracking branches; easier to use fetch+merge manually
git remote add somebody git://github.com/etc # to pull from collaborator
get fetch somebody; git merge somebody/master

git log # show all commits reachable from HEAD
git log --oneline branchName # shorter one-line for each commit reachable from branchName
git log --oneline --graph # ascii graph going backwards from HEAD
git log --oneline --graph --all --decorate # all commits, show where branch pointers are pointing
git config --global alias.lol "log --oneline --graph --decorate" # git lol; git lol --all
git config --global alias.ff "merge --ff-only"

# log subsets with graph operations
git log branchA ^branchB # all commits reachable by branchA but not by branchB
git log branchA ^master # what will merge if i merge to master? what will i lose if i delete this branch?
git log origin/master ^master # commits that came in from remote; no output after merging
git log master ^origin/master # commits that will get pushed to remote; will still have output after merging but before pushing
git log -p # show patches for each commit
git log --stat # show files that changed, with indication of extent of changes

# these 12 above commands are 99% of what you need to do with git

# more stuff
git svn

git blame -C # find where snippets were copied from

git bisect start # initialize bisection search
git bisect bad # current commit (HEAD) is broken
git bisect good goodCommit # identify last known good branch; checkouts a revision in the middle
git bisect good OR git bisect bad # after testing
...
git bisect reset # go back to the revision where you started

# or make your script return 0 on success, nonzero otherwise
git bisect start HEAD goodCommit
git bisect run test-error.sh

git reset HEAD -- fileName # unstage a file (reset the hash for the file in the index to its value after last commit)
git config --global alias.unstage "reset HEAD"
git reset --soft HEAD~ # undo last commit (go to parent of HEAD) and restage last committed files; basically same as git commit --amend
git reset --hard # reset --soft, then undo changes in working dir (make working dir like the index)
git rm # remove from staging and delete; can also just delete it and git commit -a; --cached will leave file in working dir
git mv # alias for git rm --cached orig; mv orig new; git add new

git stash # save work-in-progress state and checkout last commit
git stash list # show saved states
git stash apply # reapply stash to working dir
git stash drop # remove last stash from the stack
git stash pop # apply and drop
git stash clear # drop the whole stack



lol = log --graph --decorate --pretty=oneline --abbrev-commit

So, just copy the following into ~/.gitconfig for your full color git lola action:

[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
[color]
branch = auto
diff = auto
interactive = auto
status = auto


git update-index --assume-unchanged filename
might be better than
git rm --cached filename
when working with others, since it will stop updating but won't take it out of the repo. and you can always bring it back with
git update-index --no-assume-unchanged filename