GIT cheatsheet

init repository

git init <repository-name> --bare


git checkout <commit-id>
git submodule deinit --all -f
git submodule update --init --recursive

Problem fixing

$ git status
fatal: index file smaller than expected
$ rm .git/index
$ git reset HEAD .
$ git status

detached head

if no changes have been made

$ git checkout -

(checks out the last checked out branch). Alternatively check out the branch again (e.g. git checkout master)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.