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
doc:appunti:prog:git [2022/01/09 18:14] niccolodoc:appunti:prog:git [2024/02/12 11:07] (current) – [Chiave SSH per Github.com] 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>
  
Line 347: Line 361:
 ssh -T git@github.com ssh -T git@github.com
 Hi RigacciOrg! You've successfully authenticated, but GitHub does not provide shell access. Hi RigacciOrg! You've successfully authenticated, but GitHub does not provide shell access.
-</code<+</code>
  
 Verifichiamo che un repository locale sia stato clonato tramite protocollo HTTPS: Verifichiamo che un repository locale sia stato clonato tramite protocollo HTTPS:
doc/appunti/prog/git.1641748450.txt.gz · Last modified: 2022/01/09 18:14 by niccolo