Skip to content

Instantly share code, notes, and snippets.

@Postrediori
Last active March 14, 2025 15:27
Show Gist options
  • Save Postrediori/f9453ff2b4e2c261d433a9d169936603 to your computer and use it in GitHub Desktop.
Save Postrediori/f9453ff2b4e2c261d433a9d169936603 to your computer and use it in GitHub Desktop.
Git Cheatsheet

Git Cheatsheet

Start rebase of all history including initial commit

git rebase -i --root

Change executable flag of files

git update-index --chmod=+x foo.sh

git update-index --chmod=-x bar.sh

Change commit author and date

git commit --amend --author="Joe McChanged <[email protected]>" --no-edit

git commit --amend --date="Wed Feb 16 14:00 2011 +0100" --no-edit

Remove submodule

  1. Remove tracking of submodule directory: git rm --cached submodule_dir
  2. Remove corresonding section from .gitmodules
  3. Remove section from .git/config
  4. Make commit
  5. Remove sibmodule directory and .git/modules/submodule_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment