Git Cheatsheet

Roll a Repo Back to a Given Commit

git reset --hard <commit_id>
git push -f

Find files that have changed in the last 2 days

git log --pretty=format: --name-only --since="2 days ago" | sort | uniq

View the history of a file

gitk filename

Push a new local branch to a remote Git repo

git push -u origin branch_name

Move uncommitted changes to a new branch

git checkout -v <branch-name>

make your changes

git add --all .
git commit -m "<message>"

now you can switch back and forth and see the changes

commit only modified or deleted files, not new files

git commit -am "<message">

References