Ripristinare una versione di un file in git: Difference between revisions
Jump to navigation
Jump to search
m Created page with "{{Stub}} git checkout filename ==Riferimenti== *[http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file git: revert (reset) a single file]" |
mNo edit summary |
||
| Line 1: | Line 1: | ||
* Per ripristinare la versione dell'ultimo commit: | |||
git checkout filename | |||
git checkout filename | * Per ripristinare una specifica versione, identificare il commit con: | ||
git log filename | |||
* Se per ipotesi che il commit è | |||
commit 557eef1f5ed6aa27b21eb1ad52b72123e8debe6f | |||
* Ripristinarlo con: | |||
git checkout 557eef1f5ed6aa27b21eb1ad52b72123e8debe6f filename | |||
* '''ATTENZIONE''': git checkout viene usato anche per scaricare i branch. Se per caso il file da ripristinare ha lo stesso nome di un branch, usare la forma | |||
git checkout -- filename | |||
==Riferimenti== | ==Riferimenti== | ||
*[http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file git: revert (reset) a single file] | *[http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file git: revert (reset) a single file] | ||
*[http://stackoverflow.com/questions/1173676/how-can-i-check-out-a-particular-version-of-one-file-in-git How can I check out a particular version of one file in Git? - Stack Overflow] | |||
Latest revision as of 18:08, 28 November 2012
- Per ripristinare la versione dell'ultimo commit:
git checkout filename
- Per ripristinare una specifica versione, identificare il commit con:
git log filename
- Se per ipotesi che il commit è
commit 557eef1f5ed6aa27b21eb1ad52b72123e8debe6f
- Ripristinarlo con:
git checkout 557eef1f5ed6aa27b21eb1ad52b72123e8debe6f filename
- ATTENZIONE: git checkout viene usato anche per scaricare i branch. Se per caso il file da ripristinare ha lo stesso nome di un branch, usare la forma
git checkout -- filename