Skip to content

Instantly share code, notes, and snippets.

@janpapenbrock
Last active December 18, 2015 03:48
Show Gist options
  • Save janpapenbrock/5720672 to your computer and use it in GitHub Desktop.
Save janpapenbrock/5720672 to your computer and use it in GitHub Desktop.
Useful git commands

Remove files not deleted when switching branches

git clean -f -d

Source: http://stackoverflow.com/questions/3885850/git-not-removing-files-when-switching-branch

Move folder including history from one git repo into another

\old_repo>git log --pretty=email --patch-with-stat --reverse --binary -- folder_name | (cd ../new_repo_path && git am)

Source: http://stackoverflow.com/a/11426261/1824988

Cloning with submodules

git clone --recursive git://github.com/foo/bar.git

or

git clone git://github.com/foo/bar.git
cd bar
git submodule init
git submodule update

Source: http://stackoverflow.com/a/4438292/1824988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment