A Quick Git reminder. This will grow as I go.
$ git config --global user.name "Olivier Mehani" $ git config --global user.email me@example.com
$ git config --global color.ui auto
As explained here, a diff3 style for conflicts shows both parents, thus allowing to understand the conflict and fix it better. Also, vimdiff is good.
$ git config --global merge.conflictstyle diff3 $ git config --global merge.tool vimdiff
The easiest (i.e. almost one line) solution can be seen here.
$ git symbolic-ref HEAD refs/heads/newbranch $ rm .git/index
It works by pointing HEAD to a non-existing branch, and removing the current index so nothing is staged yet.
It might be better to use git checkout –orphan …; git rm -rf ..
As explained in git-filter-branch(1), via Zrajm.
$ SUBDIR_NAME="the\/subdir" $ BRANCH_NAME=newbranch $ git filter-branch --index-filter \ 'git ls-files -s | \ sed "s-\t-&'"$SUBDIR_NAME"'/-" | \ GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && \ mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE ' "$BRANCH_NAME"