Since the last commit, I've changed several files. But I want to discard all of these changes and go back to that commit.
git reset --hard
In the Rtesseract source,
git log -L306:310:src/ext.cpp
git show --pretty="" --name-only c9a372
git diff --stat --cached origin/master
git rev-list HEAD -- tmp
git diff --name-only --diff-filter=U
If you use this often enough, make an alias for it in your ~/.gitconfig
git config --global alias.conflicts "diff --name-only --diff-filter=U"
and then you can call it with
git conflicts
See https://stackoverflow.com/questions/3065650/whats-the-simplest-way-to-list-conflicted-files-in-git
Use git cherry-pick. This is for commits, while git merge is for merging all commits from an entire branch. See CherryPick.
git ls-tree --full-tree -r --name-only HEAD
git ls-files
git show :filename
git update-index --assume-unchanged <pathToLocalFile>
How do I remove all mentions of a particular file, e.g. passwords, large file or some indelicate remark/comment.
git filter-branch --tree-filter 'rm -f password.txt'