Category: Git

  • The Art of the Commit

    A great excerpt from the book “Git for humans”: The Art of the Commit

  • Merge a branch from a different repository

    I forked a repository from another one, simply taking the files and creating another repository. I was not interested in preserving history, as it would be a completely different project. As always happen, it was not the case. So today I had to merge a branch from the old repository in the new one. As […]

  • How to cancel last local commit in git

    I keep forgetting this. If you want to delete the latest commit that you have not pushed, you can do it using: $ git reset HEAD~1 This will remove the commit and leave your changes untouched. If you want to get rid completely of the change, you can use git checkout $ git checkout .

  • Git Tip: show modified files between two commits

    If you need the list of files that were modified between a commit and the latest one you can use git diff with the –name-only parameter: git diff –name-only 360c150 HEAD You can use the same command to show the modified files between two commits. Just replace HEAD with a commit hash: git diff –name-only […]