Git - File

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)

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

more Git - rm (Remove)

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap