File management in Git (blob and not directory)
Note that a file for git is an blob object that may be:
See Git - File Status and short status
A file (or blob) identifier is the hash of its content.
To see the content, with the show command and its hash
git show thehash
git log --all --full-history -- **/thefile.*
git-ls-files 1) - Show information about files in the index and the working tree
git show commitHash:path/to/file
The caret symbol (^) gets the checkout prior to the one identified
git checkout <SHA>^ -- <path-to-file>
git checkout remote/branch fileName
# Example
git checkout origin/master fileName
git mv <options>… <args>…
#
git mv oldName.ext newName.ext
This is not rename tracking.
Its just an utility class that remove a file and add another one with the same content because Git don't track rename
git rm --cached myFileName.extension
more Git - rm (Remove)
With log, you can see the commit history and the hash.
The –follow will list the history of a file beyond renames (it searches for similar content using heuristics).
Example for one file:
git log --follow --oneline -- MyFile
# or for full sha1
git log --follow --pretty=oneline -- MyFile
3af5d4a Backup Snapshot
4240d72 Commit message
9dc93b5 Backup - Child of a slot implementation
4cadd4f Release 1.24
c343705 Release 1.22
1fa8c41 Release 1.21
gitk --follow MyFile