Git - File

> Code - (Programming|Computer) Language > Code Versioning > Git

1 - About

File management in Git.

3 - Management

3.1 - Commit History for one File

git log --all --full-history -- **/thefile.*

Git - Log (Commit History)

Advertising

3.2 - Get the list of files in a commit

git show --pretty="" --name-only <SHA>
git diff-tree --no-commit-id --name-only -r <SHA>

3.3 - Show a file for a commit

git show <SHA> -- <path-to-file>

Git - Show

3.4 - Restore it

The caret symbol (^) gets the checkout prior to the one identified

git checkout <SHA>^ -- <path-to-file>

Git - Checkout

  • 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

3.5 - Rename or move a file

git mv <options>…​ <args>…​
#
git mv oldName.ext newName.ext

3.6 - Remove it

  • from the repository (index) but not from the file system
git rm --cached myFileName.extension
Advertising
code/version/git/file.txt · Last modified: 2018/06/11 11:18 by gerardnico