Git - File
Table of Contents
About
File management in Git.
Articles Related
Management
Commit History for one File
git log --all --full-history -- **/thefile.*
Get the list of files in a commit
git show --pretty="" --name-only <SHA>
git diff-tree --no-commit-id --name-only -r <SHA>
Show a file for a commit
git show <SHA> -- <path-to-file>
Restore it
The caret symbol (^) gets the checkout prior to the one identified
git checkout <SHA>^ -- <path-to-file>
- Update the requested file from the given branch (here the remote branch origin/master).
git checkout remote/branch fileName
# Example
git checkout origin/master fileName
Rename or move a file
git mv <options>… <args>…
#
git mv oldName.ext newName.ext
Remove it
- from the repository (index) but not from the file system
git rm --cached myFileName.extension
more Git - rm (Remove)