Skip to content

Instantly share code, notes, and snippets.

@balkian
Last active August 29, 2015 14:16
Show Gist options
  • Save balkian/fb9e68c7ec482d136c77 to your computer and use it in GitHub Desktop.
Save balkian/fb9e68c7ec482d136c77 to your computer and use it in GitHub Desktop.
Useful commands for git

#GIT MAGIC

Create a submodule from a specific folder

git clone <your_project> <your_submodule>
cd <your_submodule>
git filter-branch --subdirectory-filter 'path/to/your/submodule' --prune-empty -- --all

Remove a file from history

git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch \#web40.tex\#' \
--prune-empty --tag-name-filter cat -- --all

Change commit date

git commit --amend --date="Wed Feb 16 14:00 2011 +0100"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment