git: How to view all files of a commit
git show --name-only [commit] |
git: How to see the changes of a file for a commit
git show [commit] -- FILE |
git: How to merge two commits into one
git rebase -i |
and then pick the one you want to keep and squash the other
git: How to push a new branch to a remote repository
git push -u REMOTE BRANCH_NAME |
This will also create an association between the local and the remote branch, so you can afterwards just issue git push
.
git: How to checkout a specific commit/version to a new branch
git checkout -b branch--new commit-hash |
will checkout the commit-hash
commit in a new branch called branch-new
.
git: Completely revert the last commit
git reset --hard HEAD~1 |
will completely revert the last commit (i.e., everything from this commit will disappear).
git: How to revert a file to a specific commit
git checkout COMMIT_HASH file/to/revert |
Will bring the file/to/revert
file to the state in COMMIT_HASH
commit.