User Tools

Site Tools


doc:appunti:prog:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
doc:appunti:prog:git [2022/01/09 18:14] niccolodoc:appunti:prog:git [2022/01/10 09:57] – [Revert di un singolo file] niccolo
Line 256: Line 256:
 ===== Misc Commands ===== ===== Misc Commands =====
  
-==== Revert di un singolo file ====+==== Restore o revert di un singolo file ==== 
 + 
 +A partire da Git 2.23 esiste il comando **git restore** che consente di ripristinare un file modificato localmente alla sua versione di checkout: 
 + 
 +<code> 
 +git restore path/to/file 
 +</code> 
 + 
 +Con versioni precedenti di Git si può usare: 
 + 
 +<code> 
 +git checkout -- path/to/file 
 +</code> 
 + 
 +Se si desidera tornare ad uno specifico commit, si può visualizzare il log degli stessi e richiederlo esplicitamente:
  
 <code> <code>
 git log path/to/file git log path/to/file
-git checkout <commit> path/to/file+git checkout <commit_id> path/to/file
 </code> </code>
  
doc/appunti/prog/git.txt · Last modified: 2024/02/12 11:07 by niccolo